From patchwork Wed Aug 25 07:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502232 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345184jab; Wed, 25 Aug 2021 00:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjRZJw+t8FxK8AlTckorh9fGpltobTbW1BmAKzxS2xLRUCuIvA3UMcuzx8NwLmBIJojcds X-Received: by 2002:a05:6402:430d:: with SMTP id m13mr46627005edc.372.1629875934188; Wed, 25 Aug 2021 00:18:54 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id dp5si5379454ejc.132.2021.08.25.00.18.53; Wed, 25 Aug 2021 00:18:54 -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=H1Cmkyak; 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 543724003D; Wed, 25 Aug 2021 09:18:49 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20053.outbound.protection.outlook.com [40.107.2.53]) by mails.dpdk.org (Postfix) with ESMTP id B142241199 for ; Wed, 25 Aug 2021 09:18:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mtzZVOcvkttPztWGs68cVqBqJtYEWr1+d5zQiESL1t8uP20eLf9j/LF0FGl5DNkKElDyoenCCfxnzDjC/h07BjkhFq2qrg6JZcOZJdi8t34pIrxBzYoPeGa6mmGQ7j0/BrTKLkaK732bpojPukLoledGSMSrfTEnO8Q0NhRw8lOSh47mubBe9K02718oAtRPInZJFU9i/vsQRUg3wzcDmlcsvxqQWqnM3CS6FVER5cZ78gIr+ZKgiplafMItzNwYZ9zN5m6J2Pk+z3HO8HPvUIjXMZq6F+KajpFiIlNqsHzAKrgzp4pLsEVTCQN8CVz/gGeAqRfrO/EXRU0AsEWx8g== 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=cFPa3/8lx5umZEasF9N96wdxyN8tKTPtutLGse43t1zFLXnrCnNR8M6oRNBRAdbOoxIQLTOJLETYaj0hNosDcWQSiOKc3EQkBErDhscuAiT438uMUjtteR+0EtWvLHL8wwKnxnAAeLZgHZAXH1N6xdU4WQ6f2Eo9muxAfWIWjv+6djYEstvXLNEel5H8NugtS6UzpDXhl7YTj4Ztyj92kSUxLUItw3nDBlVoslQYs7xYVTqa+x5/l+lfPsdaEQbOlHO+PUYEt/ZSN6u4HNbFnjsIwI6vEdc7lLZSGX3+3jU9qG8BJHvCSH+IdxC0+cspVjNW+J/ogNX8FkNvA/asxQ== 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=H1CmkyakwyNhjLNNcAPG2aw+m4S8MBIq19xK7itn7fSszWDnjo76igXiH2RzCUChdUThDmu+Ng21BwjcSQqhp1zua+1Nlasfv8PccV/0CXm0sM7vAtKriZcUC9G5gSwW+d46lPbl+BEL2OKV1n4Oy6HSXrG8QtvLYt5agBPWY8g= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:18:46 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:18:46 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com Date: Wed, 25 Aug 2021 12:44:56 +0530 Message-Id: <20210825071510.7913-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a53d8231-b70d-4798-5011-08d9679893c6 X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: 6ApCIJidEtRh+yFQYwSzwsIZz9jNmT4ok0roLANDzwa0hnQGRIyTljH3eqx+lhRfCORzwrTabZYMWp5CCj4QkQjcS0JMEyf1zCxYLe5cLHRLbUfz915SBfiT7OozO0reRAWkPITuszBeQXOhoShrm62/Wiag/nNjQyh/f42ioSQv5zmSARftC4PRy9mthXXww0gD519UlaD6n2+LX4+Vo6iu/mwEHKI2dZX7VUPFyTftuixWOYjHmVp0bV6TCnZW9LvOAg29jKJxTSEoVUjv5WDd/Xh4TkSPmO8EmZrGOHF8GYXs7UEemE/5msI86WWO1cQB5v+mViS+BprAT1gvzAx9W89xWkoCTaw+qK1T8aN98i9lN4GQ5PBkNsbMTEe+uBjdG7lJfjJWLX1qhWgzfINAC0aka8qu0aq9oBdPt9QuulOzgoh10543Iy7cGW35I4dqabp415V0y4nLEOkSlCQXTZKS7ysb+0NSnouAUyVwyrAchMzH51El5+xZiohgXkqjznIVT5+Yl5hxV/co+9RswrUzRO9JMxabfFSi+hp/hMA+RdHVmIT4wz1xmcWpYmpc8qFIjLBGYZ2DFd4tUOWw4DjAnn7xlwlprIDyfUl3DZDtjgLMb86qosYMqrWU65U7JSs2Fh8DlMp17QQ7PL37AF/DzoCurL/DhaYiriTy5oaboUQA/FKO5I8AoMApBrvwAF+wzJFrUMUSssxJcQ== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(6666004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5erO53KsCPUrJiJ6bQ8BszL39vSGShE+e5R6Iwa3c4nMtuW8PvSUN90xMV6S5e3++OznvVsWZ+kOW0HaRxDOyYmqyb57r9KHZ3CUj46jfy+OmScUl4nHku3Jj5ZvE0faweItJ0lpKbQ1O9rI1fNw8qewS2U5MD74iU3ElvLQaWJ1azjuxT/BeSyDDHrY5eLwQJxGaMLKWSPgTUjjSCKZNaFCEfaTS9njG8B4ImrUvvIwWzmGUakcXKWlspwqNUzns/DH3TGr5YMz/bNdKzGmg8AzoiYOUt8iinx4QZrMHBkr81TYAVk6G63GML6V9YPxvZYkDQV2ekr6S4uZSYaRajXglNFW+qPocCKA3puqRdTMm0+myE12ZUpe+iOAkMxD5VJSWfsAulzhH0P7PNMCpaCIY9JHzp6s3FqUHGPEc+tMeYZzX3lPQY3hTJDsCTyhsferpwnD3NE38uZQARpjPbkG8w8talDNnot+4uBXCpDXDNUgrYnZpEVUDaDAOuCvRuMJqmbvmZeArr4zKzOm2JFPE4mzhNCmQFxgwyOuWcikyx0mhG0RpdGTSH5qXVWQ52xgPFAunHbMzJoBBZEBusGAKFyAVtEIPfKEg9vwg9RwMn09V6KJ2xZzY2O9jSbE30i0IWgJ8wBzuwlzjKzc0ScECiUFYRIiHjeGi6dcSrrhWxszSRImLZw4L08nNCNvJlhimB9unDD8VVI06O3CxyDonrjafrKHtgr6Ce1NxaVXXO6jqwcwOG/XfI7IO5dMlaQ5iO+nE4CZ8Kaw1tEt4lmpmb6euMLYarVetVhHxVvmUklc79nB0qkCh0FKKXwEDzTIOxBEquds0G0xhFREyVjQw8kfPjdkqqvPBIXe1dRjGLFCz7HIvt2x6N8MA18Y3to7/24wnp2yqt5BIUysvDk9qyYPEK/YdKT4T2YqnBxDsnwvMXyWcZ8XWfcNYjujZA4btKzq8HNI4jpwaijcwkZyxUUQu10+rJAEWaPMXlBNiRkKjnIQ00hkKqbfxdvpysCVNM3VZuqCx+PiWVRGzdRrQUOwbNB/9HAKOJEHbiQndEjW0wIPpRjNePAaJeV4tDsa0UFLkOKP4XdcgnEtJo/8lq1k4kffVatw2qJoNY6usQGZvmdQl9lU82fIS0m8EqS79m6MLELwB5TGvN7UAzDiy5PFrI0rIgy4yoojkrRlk/l1t+OhRDM5xx3NYMm8wEKFXWuJ/vyVRunUP0G1vrEegUQioodsONMINBjTf3TBj8grWacXOvxX/5ddSPpy7Zk20b50ASbx7SI+LnMd+4WMNEx6Xo57gebgc1jja8xfmXhbZxZ0UEB5xFc3xNlB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a53d8231-b70d-4798-5011-08d9679893c6 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:18:46.4370 (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: KodxMjsWDFZn7vYOU4pIFnnVxTwOSrdCb3UednrMIb4aYGjsPTjExmbpLk1cPUjcs3jKDC2suvTZ6k9ClMb+wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 01/15] 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 Acked-by: Akhil Goyal 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 Wed Aug 25 07:14:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502233 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345235jab; Wed, 25 Aug 2021 00:19:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe5tDNtLA815/1CGwT4Qst9YQ4hCOxV8l0iswAefkgqbMH1YOifoBF1hPQ5QtN05xClBmq X-Received: by 2002:a17:906:f207:: with SMTP id gt7mr4927848ejb.380.1629875939846; Wed, 25 Aug 2021 00:18:59 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id g7si7361972edq.571.2021.08.25.00.18.59; Wed, 25 Aug 2021 00:18: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=P2Cyehgp; 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 7C63B411C7; Wed, 25 Aug 2021 09:18:51 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) by mails.dpdk.org (Postfix) with ESMTP id BC52C411C0 for ; Wed, 25 Aug 2021 09:18:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ppbmo48DkoT7FFPubtJBkeyisBmceniiTSIuhxp/XcX2ma9ZcCVaZTA3MLHiMym7UIKLZJQKhqy75rtk3OXeb8cgXjttEkGAp/30JJVEY7b3UaplI/wtfW87vLqOenv3buvrixVg88bNLroXbnSsMgPTikhAm70Gtk1QmSW5QG4g/M42ytDv7C8GphKAdXLlr+3lqe0G6R1oALMIBZZGZEeI8vxPo/JvjMpzdZzleMhEZkF+NlNSFV9Fn5s68/X3fzkrkbwDlnLsptOd5Sag8s8IENlELIqEjqsZ+rHJ5hzP9ToAMnW8yaCKotqkmtuUl2vZ8iRTskZ+2HhGgMDjpQ== 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=U3JnJTftaPszTSCogqYCGhuclSUVtPD2iZCN363brCCcTPAuBxi95giknySQAoZNWf7yyalPoiNDQZCzVlbKq/lLi1EIHL0wSA4bkgZDcXbNoi+ccfAJrJVhegE4iNKIH/2EZFZKV8Z5Ly29QIu089KfhkN14tjjmG+9SIsBUzvtaEJrqvHJs5J1QwXtMwGtHo59ZrEFIwubVmECVj2NVT2ayMKDO9I6Ot3UI856p1pQiiSnzcBfrFORxW7guwQhLsyR/32t311uNkFilUiYB6mphQB5r0duMxfdUQay8SLZ5ldx5wjbCFyi96lZlG9YWDLDunELunu8xLVs3Bgoug== 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=P2CyehgpDPguFHV9tymwdLCM1u0/pJNAFfZZcCToBVQUF0+vEr31wFA/6CNWKM9ciVWnLPiB1Icbj8CUDXvpM9CbSc4f9AqBsinpfs1+71V21bxOkF8cod8y5Y4njXnlFpjmmhjkK1MvZgDOHKsV7YramqHK9myt+iESJUzJ8PI= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:18:48 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:18:48 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:44:57 +0530 Message-Id: <20210825071510.7913-3-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2536a8a0-cf65-471e-8d51-08d96798952b X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: 5VkBODdFuCYyYq1a+IRRk5kBw75qIn11P5urihVPPrGY+PPCG3cKb/3PNYzfH1qnXidui9s+M8QhuNwxqG5tDudWF6lRDFyluA9rUF/bhfTy9I/VoWh5zAv10qvQDZmtk7NBOuv+CJn3vzidRDyaJWTAobWh8BM0oTcFMcmGdl6/1YfYnRt2eNceAXQeGSYaAUKOGVOeI6fVMvbLvCa2aJ97y1/d0hPT5J4uNfrB9K+OgMK9yKnBevffr5kL8I4axW/Kr3ujifWFUl4mPLFuZwnhLx6TC8WGAVJe8vZjb2ux+xX/eqhLdcXHLAIsVrdCjCzT1EG9x/wxonX31tK0FqF58nUsdf5LoapDAePgEJt5CPCEaJTt6v8ocrIl9/ZG2s6YOpdTxXQLUJOVqKZJeiPghkoXlI1bEZv+LQe9laerD7AZ43SySXWGo3E8epxnbg/awlXg04/7aPbElb+YDatQMLU1Di/xorikWABemzmsQdX4Wa+EajK1zwIxtRSud+w1ULjzZ30OXuVwQhGQQBKR+zZzCRrs85l/9B0CkZhNKtk2miWMrxkM4SnmxP7Xu0/J/cEWOHVD5ZgEYSzLPGT+wfWjoaFmMwXYvPthk/JuoQlkb4O9jtC5BvFPvUwp7tNQUZr9BBVW73ZhlomXLGMnhMOwvIfbxAcwTbW/Pihi3DeIxAf7xcNvZ96orz96dUHidd/ORZWNK1yOCvJKMA== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(6666004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zg0ZKIqh44eJG/WY8HIf8W3/PddAmphveUjpmC+oqowcZ2f6cfI+qOzTL3uWFKZ6i3YzfHODr9dXmBykXs4LpL3eT7/TxeL6yZr4XfIX01dDVlPoLhCE1Ur3igLhNFxBQf/Dpe760O/5zZ/3lJ8JgqQltKTHxg9PluOA7duwD6pbC2L1lpAR4I9j6+PR1qJ28rnYZ5W1+WEiLtKiiB2FNCwvDCJnASBE+o5lbOXMpRzbVBRhf+QltpZJp5srG+A3UbvPS6H9WRR29kMq1kkR/A74ZYgI0WALc+E0gFeRwnxy/eM4hIZ3dO8d9NMhDk0YgsJk9bAOY7/56k6V08wpk0kHlaj8CyGLiolYJyiVX00WwMqeI2omXavQRtWkivVa0uJgkCQBqBfDJthZanEUcijArytEgrqg7gCQJyQ4kUdinEVy4Gigk45QNu3u3OOTexJbC+BevEbMJLkqYkULqqFjRDPqYzDSf9ZLB11as0Vtasw5zN4QC33ztkdp/gPBS0Vl2Kt18n2yq1yFKyXZIdgBRZYWxfjsnVbX+/F5vnQphiFQR0mwLQOHRi0bnX2pwFtClANkB52PmdeNJeqjTizTRSqKTM7P+6z+slcHudpPpu2ddpBmlKvVmbVZxdPcb3JwycvBQvI3K8v9XM/0RYrG/1AEdupKwkekZz0msUk/hKHitlCHJ8UjGs9978cWrnWfEGm+7us4JOfT0sYiZ2kaJXvDgU/DuvEYfV5aWnK2/6DTIAx82vtFih5hE10ZmA4T8tOB8bFXf00iK6mmfEA9tVchdMkfqZyrw79ZROnbBNvfre7WS8V4jEXVrc9ibtbacpyL9EguheCMSrfREy1BqnsaPeWkpFeNcnWuzLbwA/woH3ErAEe0dG20Krilr0N6y/uH4nqp3nlp8PNUqIs1nqmhi2kKrvKJe3sWZ+RCr6QiEpnNrQMIT4scaA+k5z9BJRcz8RiLYj3rJXPA6VpLkJvdTakAL6xIJle/sR0HpXcJr8ZDpLjhSf6ID2rXyIihnElJcbJirQULIcIeIZRaXuA6s6utixlSy/1boJ/4JezP15210Ax2R+zafpIn1KUcuV/Lu6JDJwip0KNm/8T4pLM/HLQ5BFkvQI86p9PHW3sYb6eyOj+RjQPFquUpSjZlrJbCox2o1Eq3JtNKwsTGNK7J6TIdBvTXkH/TlLEsEp5cQVyum9BUbacUASChnC9j4ZCwm/ls+Kv78UMrcdgX6f0CN/ZmUbOunPszeRQ/ZLf5Tt3vwhuLZAI/cXwL2kg7Gigeqf0LTGUZf2YxvsJYcuaNZHdhCRcVV2biDYBBDjxVh+jW7KuhYm48scTu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2536a8a0-cf65-471e-8d51-08d96798952b X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:18:48.7210 (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: eQbrHE4zlxAFub0sF+eHFs4aIYcc0BTVieOSmg/OvdqLTNw3irkqLyfjg+WCNG9nm23ODA2hiwpblIrszGom8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 02/15] 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 Acked-by: Akhil Goyal 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 Wed Aug 25 07:14:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502234 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345320jab; Wed, 25 Aug 2021 00:19:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK0IUxJG29yhqDWv6+W6s2Jdg5HueJCXoqsQ3l8vns/sCX+HLoG84Ow+AbV7QKT4j5zMxu X-Received: by 2002:a50:a452:: with SMTP id v18mr26405288edb.17.1629875946374; Wed, 25 Aug 2021 00:19:06 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id b15si3242793edd.273.2021.08.25.00.19.06; Wed, 25 Aug 2021 00:19: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=M+oxE0pJ; 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 B2EC9411CF; Wed, 25 Aug 2021 09:18:53 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20057.outbound.protection.outlook.com [40.107.2.57]) by mails.dpdk.org (Postfix) with ESMTP id A68B9411CB for ; Wed, 25 Aug 2021 09:18:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MxZIvQhA4owsH1gYk0Wotk+sOqu3eji6ugtKMMEChhBvfRrHkgEpafl+5D5RVVHhqDSK2/h9Fmai1ot7ayqnefZsaEMicAljxInADVZVHGgFubeW2CDhnUQ2tuWMYqlD3CZkjpz8sVdtwsbE77nr9Hx9vlsUH43EbD4Nzj9HkppLs/nxAD2df6YPJQOD36uX+0vuQfSeICf6j9lwNZIAYGb35M0g5KnIIWKK5S8vjjHcWV2YiP6P3ki6doFr/F6QWVAM+PSXH5InyeDRn6TF1bCkyE/ucs5gLWKIHHNsgngazsZlrPElIirCkVztiFjZNoJymn9NN//3feyTuE6iBw== 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=HcqcWjhTGS+Hm+/WaWofzZ8ia4MJv73r0FGdd5I5yEqRbcrmrPqT1qEdLHowmrLNFazLcN5jd/hpmVpgEEhinJDXoH115N5VVC1FXebutGiZZv5pRi2Fiq+jgUVR7CNmRxGh+fMnNO353/XWgw1jXaD6Ii5OxXjLaVQbs7yF0C1Qq5tTZTYwigpS+9uHYh/5QBHqTdEuxaOhbgLnPRmXBcV8NeK9FQY7N2VxBqQJePziuC6Whcx2vqsCGfIoqPDCls33v8bjrd80ETFt2mTMccZQDVq+itA6XWdHWc2f2WUNOGcmZtLm7mde36Nl/Q0z2hNdFKEF4oUZrH7f93CZOQ== 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=M+oxE0pJem078ero1aQYIp2zcbgEZAkUk3BB+h7SGcinpuV/LmbwEmPyS2KUqRpVk2dO8eum7k3SGpReb8uX8svyjoAHqvTTE2OCX2pilNI5wIK70DKIcZ6Omqb+cuiI8dmc/iutblBvTfdJL9T1Oew+8Bm0A6VFjK747RwLS1k= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:18:50 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:18:50 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com Date: Wed, 25 Aug 2021 12:44:58 +0530 Message-Id: <20210825071510.7913-4-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8af0c51d-bcbe-4445-2375-08d96798965d X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: UGgueE9bHtFp3WIKmRnbA4KX+d3IdVIAPS0XJYWVRpaFbtC4hnfYiyl3QWCmvpl7EJ5CT8sbAoeprArSxccof5OAikkvCSl37QBYDbyIJ7oumbcoX0Lb9p7jRbRUjZ7TrJsRFJaouEvoqrMPn4dmF/ZkPULBsIvFgZxBZ/FQltICm6QknNzFrJVmqbBUW9chPvl/czhONJWM8EOpmGevvUJtx/6v6c7IyXb7q+uXE+kmtPR1soKYqFSDjJvqC/uxdRvo7CUSNjoSY7sdXszSI5k4GUgxtc7jmO/qS1u17PLKQN9OhCfz7DzSjHG6Qx+1sIWyxIlNu3YB/er3LTa8+mUH9py2AvjxFFIDBnKQa4J1oyJgOTY3/zQVvxH5rR2SU0aL9ybDMBYbmeBy8OmNUstWmtSG2kk2xZ2ZN09ZgS4GocZofvDIllk/cRucjFPUz3Jtr39nuWBIjjYQbIPKV3bNoxEa9Hv6dgRZiJ9A2IyG5PpgyJHsdqWRotgcDkGYB3kEsTPYf4pS49m5Y3HS7K7aTQJ7Iut7XbERMlWvYfBAGWwiSZxMDCEfGMBDyifXYjgdU8zSDaHdOUD84ED914yrewVuvyzRYszVWAd8vzQ2ahZ6/FHoxGHQkUoLbomuITOdsh0EDWtWuOfEQwuIXK/z8I2iy9wotlW1PJfFZAUqwgiB0niyFMzdW9X+nPsbjO9RpHVrmZU3Wehez7Fjmg== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(4744005)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(6666004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BYX9OBPGa+YxviVSYo6fQOk+Kg8rOAg6OjbiBnXGH7mXtd7ibZVL99APiXUjGAHS93x34CnnO5uFKLvUuf+ueelvFdh9rdIxu6nzQya9FbWEv5JDHVaauEv1gUP09N4gfyBsVEhoIdqQbVmsTmis4897W1rJFrMUACe7DyqadiCR1T5yEuv5gNuaWTSovVCljioxkjoTtSxzxMsGq99kuj90nID0qPzIG54GJbHv693T7pJBQjy3e0NtI162JElat406C6PdZGIEJNLHXDAFXvgMmVZmzm37PWRSbs5r+J7LBnV5W5dN67A3oKVaxWp+dABPy1XZklsbBrqNVlbiwfQWmU6AL0ucNv7kFJ2lDdL5W70mkTNEFj/3TFMoH+QXfsH4S6YALBZkBwZV5ouCa1VDf5B5oYg4YW3tyuHCgeAEfaYMsZak+XglSfydAzkl97Jv15urFe/yKywPT9IgpzAt3nDgofSuO01Q1YirMR92+Jmxvtc12hA/iKnPCFN/j90X+zY8mI/4R53xJ4b0iisSoX1ymDGmRX7Q1ILWJULpI2RqrJ5UyNY6rYo2+RDItrkstvbbs38SoyNeUVMcnzSguld7CaCpAw02rh90abk+lgnFwMsfLJTvhuCqB/dAIUZXLYLbwRNmMIT+T9vTdZiSEu/7Pzrr5UencSvN8Epl4ZxwD55P540SgkJRx61if/qM8Nx8CGrCc8NKu9plXJ//HopIZGEpIplzH8P4IcjeK6jSFjgc02oANB6nrnzc0dq/orkT9HstfbEKYq/NAZGjXD4+rY4RyVcRqdBhg1lIbViI6aw5jVelTCVpSICvE3F7nYJ7RTew8q/lC/WcCcEUIxXZD6x+1dnTyhZ3yOKEG2rsGMLQPxjVTGh4p+eWyLz3/l+hIadWXMlmI7o70eD30HjOAqmJaYjiXV8gjRrOwe6gmHr763SVhCUUfENywhsprrmpZt5OXq5HqwywtzjzUFpDv2SDqvREK2H3u6U0abm/yIvpcPWl+8rHiIxuWk6TueKWfImhw5nhTgo5hvR1bc7rKh+mILZUUkhgNnjHQUnhVBstodZEYwvWhU15mf19QKgKe7sBJDa/VUJEUDJoxc6iB4XVDpGBXkIB6jt+wql7jyBu2wJtKhT/5g1QLF2U4JlO0i6lktAuxohYQAAdNZ4UrcoKuXleAyx/teNqZbm92TZKF2DkDEuohhxJ3Uq/OKl813+Gjr7q+tmwkq6qsI6UR0bDyb/CZhQ2NB5vwGJkuh++MlVEGbKM2Rohx/MsGmU5daHc4maHVgMJTJnXEcF0Avma16DQj5b8Ea7dA6jwFOOXxe4k+PQcQkRW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8af0c51d-bcbe-4445-2375-08d96798965d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:18:50.8093 (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: hCEI/0zaRNPp2aHEEncov2upM2UXycCHdSmfN0ESOxWMmOKqlNFcsG/ffRZDkf6XG0IotuTirmJrOe/Dk2yd5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 03/15] 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 Acked-by: Akhil Goyal 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 Wed Aug 25 07:14:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502235 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345405jab; Wed, 25 Aug 2021 00:19:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdzbta4WaV728SosCkGZrDMlQJd4q9hvXnJIIBDeNkK1p5YxkIGfxr9PvKhDr/Bp5iI/ti X-Received: by 2002:a05:6402:27c6:: with SMTP id c6mr16925765ede.111.1629875953786; Wed, 25 Aug 2021 00:19:13 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id d12si23103721ejj.50.2021.08.25.00.19.13; Wed, 25 Aug 2021 00:19:13 -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=KSuuN2zT; 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 3EEB9411D9; Wed, 25 Aug 2021 09:18:56 +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 985D140140; Wed, 25 Aug 2021 09:18:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aVuv/WIGqHQ0btMmukUpjz4sug6O2J8IQy0JYFVhYruUb9QbS6S62LOtETi/FUMyMi+3WnIrRk71nenX4FRKKcW6IK8bc6yGHuVQg3lq6fBLOekq32I0zNP7pPFFFaaGBq/yrWBJqDMeQ7OD+t96+ZYWw2Nm1tJWJTG6ZcA2HK46Gm+B8D08vLXKJn+bqWzgaYjVcBi/jAj8KW2JBjbTzb92hjIS4mhTwryptftt+gmCrdCt5UjoBbyAMG/5Hx1pagL6GCRMiu7LhE8oIG9ka7VZs5lhuFpcBENcbmGEO4UXjAwhTm7GVuTyaoMhl1GDdD6D+UuZA4mDFMdNdjYRtQ== 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=3fV331TZzSriimeXyPguybwCyUI5AMS3g+uO0tgL16Q=; b=Li3KlurdkbcNsLLwhmwbi2KLI0Twk83B/JtxbcsUaXEG+EbZ4JE20GHlPuJ1J6On5TOr1LsHaak8EMbz5L2rXyxUDA/7cXIvjOztT7fgP2/BRhkEzybtBfOiXyN5eGxKhvORrZ0G8RTTxRDDopcA7iwNeHUNuUUijIaf40y5sRmMtSEO5QEDoS2D8N8uceA3M8pOg/hX8J+xUVwyIjAw2gmITrfl18d2Dr23UxBhWcXYn0hI2bHuOhUSUH3TyIiZkQBIwHeMZIe1iphJvb4ujzQIVknTPSzwsW3T/CZy0SQdxPaO9v+UAQxVhc0pwQqp5jo5KSah5U5AiflsehZrEA== 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=3fV331TZzSriimeXyPguybwCyUI5AMS3g+uO0tgL16Q=; b=KSuuN2zTX166LWrQ5YKep1rVwa/Ut2lnCDi/MUZ+HzH9RSsqa1GZSjZZPQe2a8UUwH0eAuQBRuVzoOxlEvh27TItUrdFjmkvl3urgvqn17CpPHjKgB73S3S3+pUkk3l0SBrn7yfC975WEN38GSmWwjJnPpu3v+/gYbHyu+6knoQ= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:18:53 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:18:53 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh , marcinx.smoczynski@intel.com, stable@dpdk.org Date: Wed, 25 Aug 2021 12:44:59 +0530 Message-Id: <20210825071510.7913-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efaa5c06-c4e1-4ad4-4628-08d96798980d X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xKpnwBgDFvheSK5gHTorOb/F79rirCEK1FiAe3EnIABc1z/ZlYU5VbOUnM9Egy3FlcdYFbaC+yjmEgXfRwMI/owxN5dd5hh04JtfDq4t8rZ7v9Q26DkPF347dXqXil1V2Ds9Hn572bANnXE9UYWK5fyaEF6ztEBdBsiZqbONe9JGBhsRZ6UhGk0U9M8SR3yMc6+rBr8doYRxTlkr65zwlqnYvXhrNtEyQqG1a2I8Y1cz3gq+vWXXGgYiazJ0qbhisU1EQ0LCwedD2nvIyfcmt9aOrUr9K/jrlkNSFp7vb5GALODhyj1TFwrwRuS0mis+1MuDbOXFdViPPxzoo9Rs8nmGlsCrHiHnpb6AfMYGjjLLMNnWOOVeOkcc62HmuTS6otdrZS1LXmBkfBwRggaMq92XPMNqvSYVdKQFepcVUL1xAVaGWGvC9ed5YStT1bLZe89/f4VVZAir1qQyLYdNKobyGC2FUqqy84cQYTSp2Vq9Q3EG3aa95z9V+1rNUG2AUbiHNylMn8BH9k0QZzP9RVXhphFsJj+KZe94Sc7l4jRzEmB/VPpCpWk4bw1cHG9jEppPpkraKQsFtJiGzsJAJzt2RY9VG8kXsmbTg5Ve70xpdKLdJnsFLjOqn1j5RxgZ1Gr0x06Ywi0AnE6ebR4DmagBaQsEMX5LjkwgpsIglrRaHuMZIc8jSN4XMYMJZ2o+HIea0U9KGLh/wASghikNmA== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(4744005)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?9kIRDFCoal/V314Wzp8A+C1dg?= =?utf-8?q?UpKWtbiuvRn6Rqk9tIDLp1SUv8Fiw9wGl4eykHfLuKCAbGpa1AtRnFrn?= =?utf-8?q?5KVchoESX6+wxefJx1vxLiCy04yFoIU7ko3mOFRA+XpZnB4JGQZdZM4/?= =?utf-8?q?PZejtM2mpSCLXG0vliXhj57tPngPLI58uZPxwApdWAJvW+xF3bppUjfx?= =?utf-8?q?F6H3f2qgwsQK2Pq8zcPsS0EC1aC8zEPJ+U1GOCF9bmVigvEBvTIa0utK?= =?utf-8?q?UeOAGufVsL0x9zsYvKC537oSz+NnTfhs6mHpQ3AU3UqBVnoTbb2gvBwy?= =?utf-8?q?rCFn03rAMuqgW85pIBe84a+13WibP5f5jX0F/y+NHCf8TWm1KIBN0x1Z?= =?utf-8?q?cr4bQwUY6NXCva+bDdZKBLaIIE2O9VEiMUXcpo7ompRO3z+haWeOWNe1?= =?utf-8?q?RlJFuRDXyQPBOPhWMiMdvyFaJbtIeJp+3nlBH26oY7nhancQHN37uScl?= =?utf-8?q?MBArufpjmeZi6BGH8VrlJBnrx876sV9b10xZC/5tnY29KAxjJy463Avs?= =?utf-8?q?DVaw80p27boba71lhV4TyCR2iLwlsH7zQfCE6SFwhPORCnSPWvI1Mc8b?= =?utf-8?q?dpA4aA/88IOj5F84QDV9XAg08kYxvJ5ILHIgA8QTEv70dW98cIKJ7LuW?= =?utf-8?q?Eef53THsLwPVNtXCTOsWIH4KyRclvNbKhAwFCEMgnlcyBUCUxI3xY/EZ?= =?utf-8?q?miS5uDGrqlswghe2pvrzELCl8n6cvjIapWHP5r8wQHZeSABLxRWxnKSa?= =?utf-8?q?hNkz2RGoc7bwn1wK0LhafC9TAnRUdvsob1WPZ5rbtK4ITQeMccv8jBRj?= =?utf-8?q?/UJEZQR6IIwePByOIaS+oJSwkKTpcDZQIXznhPRdQ8behARyuL8fus8H?= =?utf-8?q?FM0mPmwI1Jja69aRMk33yABVhCH0oDClz3QhgGa2BExmHou1+rTiLVLq?= =?utf-8?q?KnY4qWJsqKg9gichuF2S6Qk3nQEGnwocsAvsXWRlUs+sRUvTfcGMIvUg?= =?utf-8?q?9hOzN6C3E5dfDNpOKSo3/kJ4YDWlQRWS7Nv5AqBd8JUdtK/AtVKR1/c4?= =?utf-8?q?ug0Pue9+neCQnczCMF3RAR+f9WmmXWX+ApExV7aOWysxAhzUESgV8Csq?= =?utf-8?q?2bQ9JcZq1+pV1d4Lfvq1Jt5fT8lLTnnC5nCzrdCv0ZVCS//D8Gi1p7O0?= =?utf-8?q?GD6dgwYp7/+obc3zfiKKwrWPCBkqFHiirVQH/MQxvH7+D6Al1WTtxj2G?= =?utf-8?q?5xU0gHpwJZ6frfN1pA1UloTMvKXi5MJGYRQsRr58iOvPxli81X4Mqkzz?= =?utf-8?q?C4+HJ0g2JYaGIphp+6rWFPSJNcw5zxK9CMzoebvAr4lMouZcLch6INAA?= =?utf-8?q?lPyZWpSsJ0r9SMU43XiKVIMqOqF6NCu?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: efaa5c06-c4e1-4ad4-4628-08d96798980d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:18:53.7379 (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: ZvJSDyn05gGTq7r4BqGcO2hfcIoCEn9r8yprYX1GHM/8ITkhDj178LHuHCbH+AmdZey+XOILFsDMI/hw6gwhCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 04/15] crypto: fix raw process for multi-seg case 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 If no next segment available the “for” loop will fail and it still returns i+1 i.e. 2, which is wrong as it has filled only 1 buffer. Fixes: 7adf992fb9bf ("cryptodev: introduce CPU crypto API") Cc: marcinx.smoczynski@intel.com Cc: stable@dpdk.org 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 Wed Aug 25 07:15:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502236 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345478jab; Wed, 25 Aug 2021 00:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE8fDKP9xA3Jabj8/yc73zqj1H84HOvqlhXBseyJjF93ezhQtWgaq/BQm0pYo5P1+IGYL/ X-Received: by 2002:a17:906:408c:: with SMTP id u12mr14661274ejj.413.1629875960909; Wed, 25 Aug 2021 00:19:20 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id r21si22661815ejo.665.2021.08.25.00.19.20; Wed, 25 Aug 2021 00:19:20 -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=MUmx35cM; 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 2404B411C5; Wed, 25 Aug 2021 09:18:59 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2078.outbound.protection.outlook.com [40.107.21.78]) by mails.dpdk.org (Postfix) with ESMTP id 537A140140 for ; Wed, 25 Aug 2021 09:18:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LHknbAZ2WgbZeDvN9BKXPCaL18DhMdaUwrAIfwHPl15UmIIv02nwRyVP25dj4zoAHohHVtiyJaJsM7s6yb8URtq3piHf6hvLF2heeGxu5NaGbgtmsDc3IPBxmoFjC3wdKFO6H985SoA4hK5Ft3jE6ThlVlWsARnyIHjRdbc2/S6aJtBgtEm0WqSsBSIM/p/lPOGuu+0rDQu+ycSbDI+TxrEMU6UWsS36RAZ0/F4XZ6Ycjy+c3eTBAxeH2GeChTGHTFZX0Zz6BwkScWY5kTnO82RnPvY9u+GM/ZkLfapAuNV82eb9GLqxqVBm2YrEBNWL02TWF8PCLoe/obPxCf/U7g== 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=lxdyUksvQgMANlMhd0F1Vwv/qTYjegwTdt7cjcJtkow=; b=hApO604HLE050ZEQ7N1MwsOKvqoBsD7R++R99I/ayUJmgrU0rhm2sm3Ewdlm6yJcpkvaZEbIqTEylwtIzDWZ5q2e3Uv1CU1tjtFRBO3/5RXsqr/BUleXFserpHRMJv9zNI6tWkkPcmJXDMTt0cyMF5VBqorhK8Do++3YMZuMuLKEMllZvRpJV5v+L2+OEbcIMlI1RLwcB4AT+cb+DNyn6QdCtnYtcjTXToyJOOo1LBeTAyXn71eqFZygBbd4dCG04dek+SyL/hllV2NOoO4erqfiBdhA+Iq7JAK4/RxSlZA7jm9ivoxoiqjut3wk3rNxQUZSC0NPwoOn/FtON+CNSA== 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=lxdyUksvQgMANlMhd0F1Vwv/qTYjegwTdt7cjcJtkow=; b=MUmx35cM5Wj922tXk9K0gYG9xottkVDwsMrIdjbpw/kPon20DF2h19HTxoAA9gNdKXj+pzzuzE63eY8cGB2TY2dEQBun31fzDno/vRZMotuLsYebUBnLH9i/C2MbK0LjZ53lLa1KdmjlojOY3yqkwRnijdvV4p68z3+QOBe5C2U= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:18:56 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:18:56 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:00 +0530 Message-Id: <20210825071510.7913-6-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3c92f6e-48cd-440d-5d26-08d967989984 X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: DPKLUFe3RY7Rb9R2RmVk0vA4yTPmFe4AGjrVCz6Ovz14YQx0mp4pFIQQwCgZhvE2ZpvszVGujzt0wx8D4x8hjJdt6FQ/jXZbol14axftqzgqTM6wgM/ktyKnsHPQTkkKSuC+lKwLRH3cW+n0oqkw4djF7E00CIL3bo/QlALx7SqQZiEzWgYKtFPiPcVKfB+WUW3OeBUDsCy6SZHieg/ibVaf5rQknVb7dfvY4cd7tXV3lI9rT3hTm/Cqp9co59JweyJ/GF4RLoqNNVaU5Qa2t8o9SD5V4B0Fxkww3q+BKGj1NppglI6oUJuEpyNvJcr7z96TrXffG8muNnLelRjhjSwfI4y1iDmAD3bNDPCKwWWr3PRX2DexKHvNKaOLX+zMWSobmaM31K7m11xj0bbW1UtoHbXSRBrtQfgfUYh0DSRRfpxHtHyFFL28nGoAGKv26AbT+YDgv3a03WMPJa/3jklTOJq0ZmguTut3uDT1/o2QM3rfb8C4V0ua4z6MW1ab+RHf/sKYRuem4bnSBEXVQvgKnk2uXLZoHiUDW4u1ucydJKyRH8GIMRT3p+eJcc3kvrg6N+Eew0uLn2U4ro+Y9VgZ0nNbCgfh3nHwhcrwxF63jSkuuFDRyZYk9KZgYCygPRlS7hP849l55qIu+hH4uXQwF8gTzj7dTh/8MR0O/4ZyvNlMFvnYV0wp4WjtHdu/YFnn62oVuRsS+4JGB/ciYQ== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(30864003)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(6666004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HHm4veKDrw+ABleVzZNHzpMzj2mUMlKRhSmBIpQVukgFA41LnlXX8437QVG3n3JBEdQ1CpaTGJTjZivif9rsJwlWw7IMMOKFqBp4ijAcfINfL8RuC6IbvcUl1JPEd464PmAjuc9YbwXugoHFD5yFjbqV7V9ben9FNaplo9hEL/TXAZgK9KOk38bpw+MDaXD9k0JhS05GPMnVtiI8Ra2RA+hhMUHpFv+G0kTJwSKDB6MjpMgk/BJDXhyKZKDW10hSIkEZZgnV3kx6x+n+lXtum56aoiDIcrnkATsPKsbQBPsiWX7f5Hh/32ZKhlxKwwtK7kv9bVUAGsKTEx54AK3MkW/K0DpNQbnGDOMZb0IQwRL2bWPaLIXhL8z1rWhn5LYfoe9XAmp6STxq/l3q0ke0kVf4QRgq/HjRZwC4NWvUERd3Swl9ehdrMMo13ZsWS286nhXkl3FO8+tlUdjAm9rMx+VshapjqdtPvpIMkDsqjcXD9tsM5dIoh6cuvolwLB8ovbYLycTDoeJufkszQkL1apCrh5fdm4fKlHgfR/bPBuRU+6zlnIq0R7WOsJ3NhM0d7rebZDVZUWjQNsQJ/Dlx89gKI2xjsNtM3SsRgl70HxULENxr6EXkQp59Mtd4QdCjMaXzRoFYyFJMU9Kdvk0zaWbmGQuvmI+AG+iaYIYWtSAK5Pk/WDR0R7p16aeId/h0AWYg+XFdxeuQRjNFzPbc5qUMn7USgoXZ4lQxQbC8p8GcToXPXwVBPsr9LcV7GGY5pjAQJ2xcszs0qr6t7C/EsORIKsnePBz7ZT4z78GCaUvUzxIFYaQ2pdH1WYRtQr1cYUuGkfer69EonNEoSDLi38VRzfMM1VTdlse8nLUoxcqPdmSSvkHd1CDCG9K1OI9G+dr4JFDi0LJWWiZeJaD5KaECm+OEow5wqbcu2GCJEF/aUKMx27oiwsbtxCq4po8vhGoZSylduTUqAw0cqVoZc6HlX4ok+QJN8ehLXpoRXTlu2ywdO1kIiYooye4/tXUr44zbA+fXGEmnKJZvCry+bCvduQcaf2972S2wJ6ttjfrxJYQQ1ny7B9CKnJMAtla5C9b1JajYPCSabsTJLX6osoj3KQWcW87IK7g3jaKeoYfLd54ofuNmtndYvwVrvTTsn8NXt+viFLxX0UZF2NgTlh5UbrYB92hqiIxbn9oR3z9uPuBfV/vmbNOpMZnV60d2duCbfSCBHo5EKbhYgpFXQ0iR0hfwMFq+W490xh3OaOGiqi6I+ESHmupkTeKOrdi3JBOi6bcKzHhePtiSS4ECk/nMR8+f9AGIFgxELrKQ0L0L5F4cPXDUe4JGxaFa8tsG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3c92f6e-48cd-440d-5d26-08d967989984 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:18:56.1334 (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: ni6RLRkWyqAcKhhVlgtmwSyoKdm16Q4wp7lo2fz6Ei+8In93HlGgJIuSCck/zVB8QqpNJqq//f82S1AnpUI2gg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 05/15] 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 | 595 ++++++++++++++++++++ drivers/crypto/dpaa2_sec/meson.build | 3 +- 4 files changed, 642 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..32abf5a431 --- /dev/null +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -0,0 +1,595 @@ +/* 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)); + 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 Wed Aug 25 07:15:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502237 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345557jab; Wed, 25 Aug 2021 00:19:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwGZkx/HnsH/19jAsSNj7AqALTf2Igw3RhrdBrZopcA74THeWsFv+hEe4otdaKvrrNOl5i X-Received: by 2002:a17:907:94c6:: with SMTP id dn6mr46587847ejc.287.1629875969223; Wed, 25 Aug 2021 00:19:29 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id v3si19889394eji.473.2021.08.25.00.19.29; Wed, 25 Aug 2021 00:19: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=VLieUraZ; 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 C8483411EA; Wed, 25 Aug 2021 09:19:01 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2040.outbound.protection.outlook.com [40.107.21.40]) by mails.dpdk.org (Postfix) with ESMTP id 52131411E0 for ; Wed, 25 Aug 2021 09:19:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ci9Q1HaHvjG4xaV8bmP7xysgbOFinqo5n9pTrmKaziD0RB/CM0k9qMhpSifc21yZXUq83o0LSMy7bR2/3sKCctEnvu6lyKEiW5RLAlbikdvmLMwwCzFPrdZfYEhhDNbIJ2A1Sh8v1ae9lKmbPhQdktrnMg5WYnsTW/wM+5sDvMd5FashuAijQnCH7IitMUNbCv+IRYdEKeMOeO8UE1QnD1vUl5Urk6TFTeSxIy3om5vUfkFOcZNhbtouzp7JMwwePGQY30Fr0dZYFdPxUfV9nERxtGs+eXS7TtSc49fOV1VSfINVWTPWMqTOiJkRUuYHZXbqz//tC5es8TXYXckcWA== 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=XQwCm89ieuX9D1ojA8sGVwL3QpSqqoe249Ajyl2B+O4=; b=e9ARcSY7+jLy/T3MgecI7mavgi1HZgaU+hpc6hNk+TZfp5OyKfKCw/+cvPFK8u+9R/XXe0+c3q9MGDBW0BqA1qHJdVcJsq+5Z1pbCF+VOtQwupi7sf3q9UdvTUhI75nlCAjtcnzq/bDoJS1tI0fNZdDhZJL2yNraXNrM3E/0ORcOdlyeL6tu23Glu7spe1ylUyG+aFf9tkTTPuQKve2iOOj734HVZuVLj2ijQXio4+JNcYgeaHZjWud6XkuFG/u4STz/Jm86dKavISS//F5mTHRt+pEKWmhDXgh6xgQT4oIee8Ttak5Qw1SAnxDkCQgorAsQmS+FGQeDcNwaw8eIhw== 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=XQwCm89ieuX9D1ojA8sGVwL3QpSqqoe249Ajyl2B+O4=; b=VLieUraZf1cd3pIMaAHSZWm3TCksAEgl+lCOFXgP1wITASEndn4EJYhFXNdHVSYiiAJVA7EgobaneLTpJgnsE7TTL6n3dqjWgWt7VrLOY2TZNIl4aHvlXU+x4/wDsI8xBxsEn7Zdldsf54ePPqGeJEb7txTv/9vMiRKm+ls5mQU= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:18:58 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:18:58 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:01 +0530 Message-Id: <20210825071510.7913-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0919b3b-a03c-4d7a-7080-08d967989af0 X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: Q9wc1y3k+tO4BmIqYoSaw6Rk4gLqNl0ml1ApKhMCM/7ZK7hY4mts3uTZU2MqRRrzYoqLW09IIDoA+zlu1IFH7aKveBU36CW0bS7KP3+N6RQVWvhZp5/L3vaaCiQ6mOiKVLQHVNpi2t7N0AW3wD5PgN0/0E7WRVW5RrVrILo9xqm+R1/Tr87JEB7ml9MffLW9eShbucuLkS4znXnOAfrBUqhiLYx1J5VO2IQi35HVH0f6sv/lXfdrzFOwP7uY7uUZCaplNvef3g8QerB+IN0Dxu1/LSeu9A2n/1EHLiRgC0ICQcS7HBve8GTCwORHlqjIh+gH8uuBROok6F35eca+/uR1z2eQ+XzkVbdgw4pFK8VrGcBCpprB1EQWg1BE3nIdKmF8Mh7LGKaHJ5gzCKFwEwfXTIKY/Lgt1wGSw3JJ/utka5CpWYlV7Vllqy0SR+aovnz8QWQahP/cZRuuiy7i9YDWEjlrMfUlzOWmXoWw6zOEVB5NWcGbjfh+pXqloHLCGvTBRcereDPpywfzeuUK6f/uhhmW/n2ofeqcgBS6vdJWycwex+UQ2s8AXv9zAdcsJa11Zj9FODOn6/0NjKEmsYJuIhyyMF5fkf1VT3LuxuK+FLbqu9In6MH1KyEYPQIVwrYJgs8yQtLsU/CI9YAbTYahUKWNX5w+D4i/BB1PvQPVVzaTLoDkkq68XTJpc9dfnMLEihfgQEK8cueeeTTokA== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(6666004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: facOuIkCEGdWZcPCtiQhpiMIYYPVtA2/dMg4lbhmfD9Ml/903yTS1yW5rtqX0in3JSjhihY3BcfQzkrbLLrJUEwG/qUD75ypK+Q4qocYHrNZ/U6IhXxp3x0H9R1iJ/Qt/xnr/agVeHAcQWAQzZN5rOBsP+3wzZVx9ZdeQib1uqRszJWmR+AlsoWlmqvOM448D3VGmR3kQNqSbLPl8ACAaQxnjTPPv0fMv/RsZuKiwbJd2Tiuc/ZpIbyD+nCUsErLbqVjVRsRCZmx2qSap5V3rutqHmbOoKVWQJs+tqqcHt9cK45VEve/rjrAYhufzBIkBGpMMRIJjHGa0qZuOqIcx3F1iEMb2/ol+zISPDGgGrCy9cJv3Ko5nnmUPWe7R/lWP4EE66KoyYzxtP87n7sM2L1OiXSN24WCvMGsk27JhG/n7GWeG2IE50B7HM7i4NSAb1vHbw5s4Apye4EK9aYIB/csEV+M7TCh9cSiHJuGQBJMDO9IKIx3Uwhg3Fx1VyPzfit5nqWZ1WFDYfS6Jsq1Tf/3l2zDP9Xc4OSNmrp4m39YT7uXhocEHyQpE4N7MCUKdAKHCFb7urR6p5l8ti5sGxsRIh3Z65FfUjWqSFzo92s+msGh68wMdJxWlwJHxh/noFQ4l2y+bho2eudPFOjWAb1N07p0GJaeZPE7tjd0L/hFtutRrsFU3IbjcIzKNxUokALuVOBwT8tVpjNEVmTBv+Gez54HYuqjD4QYCu0SMvCjQP+7lOqqzRYRGibkC0wCcRDZVT8/PuVOnN9aiGdZofbw/H9rFg+z79u+2TuVnPpxte7p4KtmeDNvMeLX4IE21xqoiUCDZ9j5wqL0gKxUbesGcE0GZokzNZtFPE4+9sF/KKCNsXAweu36jVfbWG7TdEkWaP8EWog5FWXVXreSG64yYSrfUzaIiuOvlsIa0yS4M5DPT3xRP9mEr/0wYocGOlB0LEdmBIb+e/JpN8IsH7QouAZe6kMU4cHOx3DWsiTPTrUtg2MDlZu4LwjhqFG4Z3rbtCf1Ii9g3i4KLIC3lwdN1YUnIjLsNGbend2ZSCmHLsUbB7jQKvfr4Xm6gvWyuehBszIBUJPD7PsxN9VGrVttcdM5AiQaH4BawHFVZcuTHxn/YhfaOMP970gckQEl453gTv6D2kQ4SU1/yx3Zq834SrbuovaoAum6ps0XwiTiF+hQULAXVNGMbZld+txpQfT0fBhsnbBjkvknANLH7T33/qEccOezmCIP1kqrWDB18B24OjWUXzd9Vd1sk4nqYg8CyBEsZG3DQXMTKOy+D6G7pBU8yQLyZN0xFc6yT5BWrRFdbrFii4G8BML1MnNs X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0919b3b-a03c-4d7a-7080-08d967989af0 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:18:58.5756 (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: BP1jYjOEQSy7sIfHIHrouFNrbeeXVWX4tNrBAGW1vjaNLLhPfakxyMcVhOE0AM4wLc5JXFvi6zrpiXdtTj8JAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 06/15] 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 32abf5a431..af052202d9 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 Wed Aug 25 07:15:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502238 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345609jab; Wed, 25 Aug 2021 00:19:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVDqghJ16NraV9eyTcJwkUnYPQ6khxVyRpM+Z07jtv1zTsPhrtEamCjtHbOhYourVTPTUz X-Received: by 2002:a05:6402:1add:: with SMTP id ba29mr47603924edb.145.1629875974953; Wed, 25 Aug 2021 00:19:34 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id hb44si11286392ejc.714.2021.08.25.00.19.34; Wed, 25 Aug 2021 00:19:34 -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=Tvk04T9T; 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 260ED411F0; Wed, 25 Aug 2021 09:19:03 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20065.outbound.protection.outlook.com [40.107.2.65]) by mails.dpdk.org (Postfix) with ESMTP id 33F93411E7 for ; Wed, 25 Aug 2021 09:19:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HLZop5QHYYyXXWdFpjGtDej6JchASupt5YdCxOW+blNEQMqA+loao0UbZUPWY8Q+ESOWfs+f62pclQjgOHlUh997KDwG9px3zcw72J4JvQbf5bM1X7CSdx8RXixXTik4qqvu9CrIaI/lvErczw0Z93LoiilfY6bWRvCuGQWLCeRyPk+XE+gQNHso28aJJNF+0Fn0opcW3tU8BTTF2+zNMJs/tLkPstZ4T1z0gGBH1uoCj/BkU2a5nblqozlR7PkT+5IieMNQJSATAYE4ABahFyBOK7oyfOHISEHR96LKu2G347IioUbUIVV0zpvFCt1l3oWUoa+rlF2gNwz4SZCJkQ== 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=AwF9cy2Wu06LGZsc7ollU4u4igDpcftii7N4enq75HI=; b=Ckmub4onYKdnAfOnc1PN17VIYQaXEfz+tr5ZKKCyXOle1s+zK9EqKxSS+sUg++yqSauR0HQFhyOh03rhLNuBzcXKA5mTPZmzUefoHWASv6xqz4KT8Ue20vdvLkMTfKB90CaKjk+Tpg/kn9pT6UD1sp1TwY7PWnnB3uw+Ud6x2FMfTw/QLhrO+Y/H1fyyTVv8Gcie++qAUU+DbMaeALxDsqg7sBJbH3tdqI5RvkN9AUSwzyEkUus5FZb5TzBhcwahFEdDjDnzTn2gHvRvLKA2bl40bSCgHpcCfXYHsGXsGdsGkoN1b4RZBPZjQ4cyXarOuoltoJucd6dgk7rfZetZEA== 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=AwF9cy2Wu06LGZsc7ollU4u4igDpcftii7N4enq75HI=; b=Tvk04T9TmqHKL3tBTMQDtkLlXBacnu/0DNm6IXNX8AUpBwtrXt/pZinuAf2u6fnmkU7NpsHpi6O6iqnzP37eRcHJ4hTvQAYuQWeGV6o4To/Hx4VHdY+Lqb0jmEnvSYDQMvf4KhLmRV8j48Cl38D/MMMMthPBCRgpknikJmUGXaM= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:01 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:01 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:02 +0530 Message-Id: <20210825071510.7913-8-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:18:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fba280d3-3ba6-414f-a8c7-08d967989c81 X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: /jWTVsLWkhs9SF81I6+gAeh6+VLbDilzxk1R1KuDnMsUDjHcVzk6v4aAqx6JUqr5mLNed3eCwM4Y1ij32iBV1zJ3cw6H3RpedA87ihxpMKPl95N1UKnbUbOV4y6s+0PcfWImIto3DUFkFCa/WAanzD434ODFXVmBA3LpkbGHR7a4KfPpN+WLpPJnG9ToXFrIA9BwVkFP9hsVO3dyXm9KIz4bw1R8ppHVPvchJFJoUsYBqT02jbiyArV2sXCDJHbMB4N1GCM/+Q6uuksUXRgfYSCjG/ZTnMuuCvk8B3xJyvfwosB/ap1wblckjN1kXzSN25NmSjrMl/ZwHjqEWsE6iIjPJJjwqUNa2ip1DRX0j5SHVaZoHgFH49Uw7rBPHtgcP8DJ3ClA5MoBZPEJKQMYbITA3OnABEF4yicFB5LS68BoGq46iTf1Z0WUMFRIYOG53b+DyTXY46vXP81IUf7aoBW9Htb58VXTVkxDmQwZVcLk/ivWLkXl8Cvf3WWelzZbxzWVwbvbkpudQPkh5SrvDp6denVaeCtLlsyXT3Zxy9EqH1dTWWcXEYrucoey3J+YFfyrdlZZBpVW8lEEArsmzGKbA5m+ktc+NHIvrPv+nEOTvKxJtkEDrATUnJgJTYystSGtA60/Iq+KM+zbC7c9XsJITsPpLvyX9i7Qnk/aP8sj53etXJkUvzv3+jvibz/PDwMkakX9lOhswkeBufAMCA== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(6666004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HO7pknmiFqBj502o9sWB1zlwj4Jke6scjgN3TwAGJNpmbcZCzJqlt/YPalBrVJjmkh72m5anFWjPDeI7Hk4WlrwafISQT6x4hpKruNjRgsbh9+FUvfAlY+/Nlb56D8BDk3DN90vWDoxGs+ZrC2JGsjbLI22KytTszNYqKiumafCrMnSA92kBXPN1oJ9PLJKa2x/oCVlopVNGWgdHKJyla0PNHgMAC/HU14sjtaLm4ovWiSR0urZTVwifsSfnBSHeqMPW1Z+z2XHiDjUcYRbz11nqFnVnekTTsk0n/zQ4YHjh62Hx5LGmqJpW7EZCNh5SaVEZYdTXsHWHUzY45DhMQUIOd4XDKO3SgcQ2DwEHwpe2YhtBjP4rmvJuCdp+xWOhPSkghfX0+hEFUIYZQyKCHOjxqgEPZjemUnnkJ8xfEC8Rx+CzlIhjlvqGAsPszPy9Ezy+b9UKFsL1NGMYPgbcGTWOD6ld+Hwqm6kzbDgSdtqEyO/CnbF6Wls5cGkOVSmOmpPI5r24w0FZ9MOU//aUQXxNWTA/ABiMCLynbI4mBAD9KhjHQQsx1hk90UbvAtXfl1RziARKTIspoSx4R9cvnZgYNLf1h57Lv5mj7VvWFjku/Kldnu4DKKwvsIMbggemA02/uRqQdlcJHuhIimbF+GpVkkgLmnoG/jKTWawG4KxUdjl/RkARN0s7sLqhgoE9K6DDs/8m8ZrbCH4QsU7rhRqJ69x5T9gP/4YjikuN0FqesNNnCjIUYJp0wZsWx/QDjez/GJYAr5bxziXt+WGu0f8lLDTeDSwK69cr22ghQJgbjle0X0VCWGKuVp6c8jQu1sIjameXfGVwCnCD/WQkLZqIE7ayuS3QqNXdTNGuKNvABPiBHOBlyWQJaaxpGX/xatLSJRoh6rJRtuj1yp/qNTHzV2g7gFrb77lp1cIN3QR3pATDJ+AvOwbj2YS15Lvzkz2O5+iotvAcVWqCFLHP/vB5LJJMm9ddax+gpgClokZ6v3BEBKYYwrMuNpK1CvPt7V5U+40CYcHERv/B9iWsgx49MHrJltxQK1xo9KukvOc2Zv4kva4HHf4XpnKokVTuDESp6qdPTnAwL/9NvbkbOuP69Q5ams+S+w0PiWihOR3pNkm4q00N3QFZqZlWYc5YWCTbr1r0g5dH6dyh93TTYzNFgI+EYDcXjgYRn9pee3+seSxEylyh3UTBp8TVkoY0jENDkw4aLrAW5Tj3jJLZfLd3DXG8y051648oQI7IghtrV27lGltDQqdPLYATbjD1gtFx1OVrLQeFR8tIwPxyDs2+a8Jq6xGWtpciUONKOgjZwia6a/amUOdAF8cPdeZY X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fba280d3-3ba6-414f-a8c7-08d967989c81 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:01.0518 (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: IKiVtYQpojv/MLb64Ozjpxd9fc37RcPJvhq63SA83BE7pWD5T7IXH/kTvPjYoxj5s6ysAI2r12nOle7x8N/fbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 07/15] 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 af052202d9..505431fc23 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 Wed Aug 25 07:15:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502239 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345690jab; Wed, 25 Aug 2021 00:19:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8Jz1RlVz27b1W59CvYHRyfi4nBVsiwnSAxM69axIzW0R2D8n7MKKPPy9Dfcov11YcGFyD X-Received: by 2002:a17:907:2091:: with SMTP id pv17mr44469311ejb.204.1629875980889; Wed, 25 Aug 2021 00:19:40 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id x11si20864954edd.110.2021.08.25.00.19.40; Wed, 25 Aug 2021 00:19:40 -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=i4SOjVhU; 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 6BBD0411E4; Wed, 25 Aug 2021 09:19:05 +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 2F243411C9 for ; Wed, 25 Aug 2021 09:19:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJsskoHFaM4bf2DMpKg15sWd6V+2YCsjUNOJhNT6QrPm2I/t9olpKWAs6I7T360J63YjMe2zte72rOWdds0IIHUebhd+riodLhjAf/67cIQEETm5NFbrgCSub4/xpuOrgTqjYcI93BdYBBbwbrTGMPIQjQ1RX42ogm2gRGtNHSkE18gfsn+dYB7I1S2t967ySyf9LzluUelSJTuWwG9OPWXyXlZfMNtsf6yfYi2/86PUI1Ux5xy8mS9ZwI6YdxPSgbyGxt7EB4UKUi8Ut6A9cprPuOBOUZKO0u0ayWiPco5Du2ILzlIXYBxgrfjpswvb19Tb0kLsQNIVeh1fVK2+Tg== 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=cvBi74HymQ5TkmVd+LYI9BMAoQVjPMPASJqA0hKuS3Q=; b=ALXirIbLtOwtT3ldSbA7g3EBIvbKFCR1oXXkMOG1tDiTkbSyMUvJ55QdwUhJlzpgm1/evGkVnK190CE0ovpGPgHqDJKjgW6RVarXvXoCjyx3Enr3vvNO5iOX2PLkGxybfVityqqeVl7BhuF9Ni/zcWEYiJklwLXTBnQN62aMnamf/iZ0nkHT3nfyWjpfL/zLt/KH49vCPSyt0NX1WHvcLr8esvsGwhoq4dPU98kRKBTt8zniIOlxs+QUFB5tt57P2Xhv9/wxNpOaKcXvs0ExC8lao+FoIKFbcwQBZWhD2/SXTY3CTmS+lejJ0HzhgFwhLO6BmM19LYqgKP9wjITWOw== 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=cvBi74HymQ5TkmVd+LYI9BMAoQVjPMPASJqA0hKuS3Q=; b=i4SOjVhUs25YRQL651sWFYPtmk9YwfACSQ5XU+3HbZQwPANMhVhFSnLLZBLrCbbeoAxN5wD1V7/G7hf64PpL8DInXhx+HSv5teOUqQrfbm5wgrUZxkTOFmwoXvYotWFcqNZn+zc7GcSMHRD89Vn9KPYxVhHvzPHTdkihy/Wpmd4= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:03 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:03 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:03 +0530 Message-Id: <20210825071510.7913-9-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a01938f1-8b3c-4a53-cbbc-08d967989ddc X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: YiNkkYvETsS0TWpWPEs/lG+cOic6Xl5afymDxukOCJzLkWIe8SxCwdrOh4G09jgN2ODzlEEZlRT+VNUPTlxLFU/CQ4fOAgeyB2oyTJvxEnhdtOYzISEH/8d26lZjq/6ZwS3Pjfg8Giozey/Ry8sokOgLhp5S7mE4I48FE7fICtFjiGuevQ/HtoTnDOfMcs0Z/t26m9D92Hstk/u4+VIkj8IGk8By1a3/WXqksSSqj1wv++GWEDC2s0NkXtBIV6BG6SVxo0sTGf4/QWP11pgdPsqUEztaP8gbr1BkXjBN3UNCGIVcX5U9IgawIhNce+pQ1Z1e8ItcwCuvwYZFsYQVPAISjHylqN3/Y6rIu1u9v4ftNKGXf7uhSvr6WKBCR4UssJhJZImnUJMEAnX9BdkxPRlvR5WlbNaANkG2VyAexYFLRfgREL9XqTf2ZwPaWnHMfp40q8B7Fg3WjwEGge2ABEbUBy3pDFQE+cXo+VjbwF+IQ2JUUeeC3atNcEV5cQlrNdHALBkuGzITNS3JLI75ABhC/Zak7ZBHwJSJ+vI1RKtwEEVPKecwvdTyiv4qXTjBt4wzqC8witpMDLqJMs7wR0RoKfvw+EnSk0zIlPB3CPVvDETZLp0vc99koyDjzVqf3Gy40Nh2EhMkDPclZ1aA8j9XEOIEAABGd+Ejv0GksX8jJ8m9K39VBpSQIvb1ZI8qhATHXMvDQjiUvUSFyjbPZw== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YKIlJk1yNrvwhn01I4URj5ToEZad/KRlyI365U48qW3DJJWGLcI/HTSgax27hglZDdhha2XjdjHKOwgjFnz3eFAfbCWtrzlwsmTzZHWy55K83f14eR3vjtZh2UhLI88RhK0bPZv4Y4B39VxqQuvy4jt31B1AlnQlKINq/tqt2l7aaYsKKuDSjLt8LEs9VCv0kzITINQf20ljHo49FWtUWxEOQZEU8esVZc/v4IAToboy3ZE330Oj9PJuDQnpSGOxmlBTHnjSQK+tEW+Onduv1RBkWzSn8lCHF8OIf2eW8SyQBbJBAfhN3v/r0RJu4xdDhhSbiL8h5X5xX+XSejDN1CrsU4P14uqFhy4CnCfHfQd2XckTi+ACJwByZJGwKi533j7e33bspR7X90kNLrPFe8mGTy6Ce8dwW9M5hUo16Zql/2CuJcYuYSqpyljn5a6O7meToZWSAKahajvHQCGfOv6PZJLbcbznLAWsvfjKJ6l+ST1nnOWjVenBzgv48BB+selNWo9rZQmCrBwuL49WCONC1cT/vs8NPW/7bMtr9hy1CCp6n0ugGkj5tyTCndSAuyUHNVMJLByXKLVy5NRBeY56pp+2Up3XWySZdg2PGGAIsNfx3bJkJ0B/yMO9JypaGv/mMp9VAzXEego3lqyo4jynoUUutERxCSZj/ZMflr/HmwWobeQOxLPgcBqN29yHWdp5Y4dWE6pV0dFJ97bhyXlJFz9/922/5OeO7LzbjU8EsR22fU27THSxAQeXFpsNdwr19YSor1LJ1PFj6xd2dOUteAZrtLWI10gFURz/M4gl6yxZw3Jta4MMSKwpswuH9+ouaDcVvVhtW/9vzYbrjVUXPk6a4MXoly6RIbVYxd+xfTWm4NgE+b02NtaAxAHvJeq4PykWiH3Gxp9aS0m8pJSChG7h+zwwicIMJoB0KxDa5gdCT8VD6303uus+Yg7wu8jiKDNxfOkJ1rvQLw7oZxM4Gv02d8XnUFKox+1v8ACv3ecOu0EJguc5spBHA3pqEsy3xapqW7m0/VH/mEy98vLKIdHuk4l1O/AZ9WfqMlfIzmd4vswBU2mWi7BY4UM6YzxJP+xgsZzQCCx746/YEgs5cufUw/dm4r+jhnNLpqGB3XPRpWFp6Iystqr4Vkf/cqfhof9YAANnttyN03hfKtWioojrG+jzEwg9q3myN5KQ45+GI25kJkhQrHX2mup+jBSehqkE4Z8f+syKA6epsvXbScmNqnQ+zlpIk90hmC2aN5bJveHBPOVK0R13iPJK5+XZ8PpWiiRvJeEVOC7OfvJGCi6/aVvc0jCjfIRgqO1Ho3xrThhaZ3z2vKIseS4O X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a01938f1-8b3c-4a53-cbbc-08d967989ddc X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:03.2546 (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: /mAXO46n+d9HEpX8FBcFqWKlEGucsjtuuS+emR/koMU5LQyQZMJ0Wf5CgjSRkkGOB1J5b9ChzVE95dASv4urRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 08/15] 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 505431fc23..5191e5381c 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; } @@ -792,10 +972,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 Wed Aug 25 07:15:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502240 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345798jab; Wed, 25 Aug 2021 00:19:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbD2KtGYM9mxp0aC9nqRzYY6oWqSoZ9/3pLndxHwAqWgDVvdzD4j6fDFw70P7fr9ZtV78A X-Received: by 2002:a17:906:264b:: with SMTP id i11mr4358539ejc.485.1629875988583; Wed, 25 Aug 2021 00:19:48 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id hs10si1672589ejc.193.2021.08.25.00.19.48; Wed, 25 Aug 2021 00:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector2 header.b=Hed8d8Di; 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 0AF89411FC; Wed, 25 Aug 2021 09:19:08 +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 614CF411D8 for ; Wed, 25 Aug 2021 09:19:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RCWKYnA7S4jEWkmwaw+PV5dkuU0UPWlfnK/UUjMo5uSzx9fyfCK7eDg7NecBYlF5Ol3yOR1RAa8qw2b1YkP0i0GpjzS3CtekylzNEnUbvbzXr3q5lF8zqwXy3EMCZLcR9BIofdYhov3reFWcr2xR1hJba8DVYQzl/FYU+Yo+C5ZOE82vxBlmk0V+xevL9oBmhamxDgWrhrzCjJn5mcdRyqYqneCL2n3tRQ4OY65yCWhIESbGLEDIT/SO6XcNwqEY5saR9RPSnABDD7r9RYwlpd/bXPTF99HtH/jkKtyqlmHy7AHLMvZd9HLCxONdfRlkF2owg60a3MjyXYGf2dXT4g== 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=zq/eobDY2eB2ryq5gJ2E3KzsNjSc+flFIMoI9kSMeuU=; b=eEga3nyr3rdt1viUhsypWrasIoYNvFDuxanxh9Kfm+O5vQJ0yOfAY7YHp5O0EnFOqABTj9GKOuFphOqta2ZfRi/w7E/fCZzxPQQdz9yaRGUKlgDmCoyedFO+q2uTw39g3Spphz8OdpfdSRl8QyhCEoLWdjvitWmvMYsrMY2kVJ/dXdRxhLIxslTKJ+ViiQug1zIJKFDIAG2ugQqO1wEVvAMZEQDYiu0+JnqnoQiNSP2WB/KvQ68iK5offhzFdB5NeCmB+sJWdVN1OjATVn7GQj4SCRP7kFxypx7i7MmH+JfESgNCBfl+nh4NL4ZpeO08CiOQQK9PJNN3+Jv585gKdw== 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=zq/eobDY2eB2ryq5gJ2E3KzsNjSc+flFIMoI9kSMeuU=; b=Hed8d8DiTF4dIwe4B8oPK+2ilE4PxynnwRYLRUGAdMVHB1Sx8S4k/Iit6u/nxbYc3lmc110hpoCw5aO29F25qEzk9Llp+yVxIPd7wkQT3hFLApD7SErFVOMhs7A5nb+TAcaO51Jl6Sq8PUB1ve9cQU/irwDtgcpiSIa3iI6hErc= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19: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%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:05 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:04 +0530 Message-Id: <20210825071510.7913-10-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21822a69-a9c4-4f07-e4b0-08d967989f2e X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: 62nxZuQbNU/zIe6rPaWoyaMC9z81dLWY2iRZaWCy8tpOsf3n+9JW6HNBK7ZYQ1oEvR5hRLHtKc5SmuCdrh1bKmdYExHK98/fFlD6mWFooOCXGXLRe17q4pLTez5qpTpkLzF/kr2do5bU0wmqHod3CbbjIOouluTyvRnaZ7I2dvjD2AM+PfYNQpzOuySWQAAtCvG384+Qc+8y1Qx7dD6d3LldLOAcQMoJyJRM556qbjDtTI77UiMbswS6cAbPWlQkYWNyHN71pPZoDSMuQxIOTzxVkZ1DmPc9LxLfzAA0g6JGcVQ8CCaAMMzyxnNmucFMnY1WvTyV1vFoflkrMSx+uKl1EUD3DHEJzq+8pghTzsHULVeRdOjCXXt+IFciLPxZw29ESENpOXwy40eHw4TM/3KJ9GEJft7IVc+FAtywqkfl9HTcEGZSFb87HFAKFVOzT1iZe6H++Rbh+zbI8GwyFRk26mbms/0GAt8BrLQZ7KCsKTZFqsuM8WpYYFr8bk7xGUV/DghCwBpjkR6el7vKOWkY2071cPfLBhKoBmwlLUV6oWiWOS5CikxUm/cJMw5LsnLtu31cUugra/JC/mxm0iI7r5XKwCMfNl/LI2HNKIg98KeT6i2Jk6WJqjG1NK78L1VX+t/ac5lQXhIgvxh02FES6tV+TQIyOa0rK+ZPPxXpeE2kg+qXNrnImDTovda+WmE3PYjZ8SjOgzkiOOjoyA== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fdbqBQh6dtJ28j5tD8Q9LslzHHH+HtIb6BxDWky5yXuaBsbfZSSK3EfhpkkPVSikbWAXhJfYC4LWRulo8oVo5Tk7K5HndAtdvwFC6AcWdwSOCBA6x8EKd5PL/rQiXVURrzrftwy5o9b4Jp+zSuN7NDqJYRPwWHxxKUUA/PwnkRq/lucVDx/6992YDcCpN0BPMurr0ZgSX55IQ1z5wcGnJct5lecIQj5UwWVBD18syAJKC4V0UaiM6XDKFyyOJxY8r64acT29akSJL0ge3kt/4TCcO0ovl5p4St5oSej5cq9DUEyFiYeN2i0XKO9e7I99u/xQ/FUPQrMqHXvCRnNMqmquSnaY682ONBycLVxl5iNBKOJIMeImDVcbNoOiO6ZBTtNDwZ67GWd3aqcLrDw3Y4pykO2gDMrNnOvCtY8qNyVvY+KTSZyUrhy4I2ry3uHqmJES9PwEFtjtnYpKo36lMlsy6F0zogIOP1fYw5Nb1J9GXu/1XUpGECM+JOGSp6ApgS4hhZUevtAdVWKO0BQ315Jc8jljxCftV8p22i8lnXt4ystgBvZxHOGJpGrsv3/IlIBCxLK+BvobPq6rQ+C7hMQlWhjNvCLajpzbBaFIfWeMNLqdbYvLGmpfadgCvVT8VW1uKUdlaTHsQLWg9axuZhy1+nI9AuDKMCbsVBCfC/rgowCG9PY6ySy6b8cDZNNdzUf/L7Dyow/3SYM2XLUG33LpPF0aHfzmYmNTOT4bxmjPqkRx1e1n1ExhK+TonLwIVuuKn3omKqBwhD1ZnlS/uwlTyRFbFWBIPCRBVo666Vgk8lgjUYi3fyytOqJEyH64u0cy5XB1TFl5/xmjlG5aVzLa1LWEg8GP26e23ZQ5cRo/+1verPBt2QMXAiD0qdaBaMDHcLLO1w6T5uCRvgIrz8OvGNl1l/cVhTVYbXyKum9AdZbiJent3SxMfxAkOhneoVcRzJogT49OCPZpjBLqwUOpByToerzbqeefEXXjRHjNiSbgVtgOi80FgEYWK0eApAo4/Bcb966sUG/+aqoc15ijA3U8W+Ml0htT+9Iz0Yy/ZjtdNzhmHTvk7dPy3TlUkMeFAFFFY9xkH1zrejdiJqAlRjr+mWBAgBfr5iGUA+XtBfadHEe0UOdFZA5jaGnS1DDAE/Mvd1XldZwV//7dxksszXZV4cwXxSloymkbCJeN0lOtFeuGN5omEgg/5ZJJ1VZPPyVLF1WpXgwoyNaL/TguSQped7XrBfzN2/7+qpdm6v/M6YHcbWgI3GpRu9CD+511NaElW4InbpKIKwZtjcuBjRlHv/7bXXWEmpoGIWW6s79YuvjCWgNj5SwbqAOc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21822a69-a9c4-4f07-e4b0-08d967989f2e X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:05.4942 (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: uJeqajb8h6qWEiC6p3X8kpCjZ0Ar7WJKKmvSgitMWPlTyUv33omenXbFPLxHxTJoWgVXOYlBKm0LDiVOpUh5IQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 09/15] 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 5191e5381c..51e316cc00 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 Wed Aug 25 07:15:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502241 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345849jab; Wed, 25 Aug 2021 00:19:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVWjsJeyzwN+kwoGoaoCrXh3Qs2UR+T3uyESszAKWTX7dXy8i89f6Ipx7Qawf8riDYserF X-Received: by 2002:a17:906:6445:: with SMTP id l5mr6852445ejn.194.1629875994976; Wed, 25 Aug 2021 00:19:54 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id qf29si2398438ejc.618.2021.08.25.00.19.54; Wed, 25 Aug 2021 00:19:54 -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=eXcYqnOl; 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 886FD41201; Wed, 25 Aug 2021 09:19:09 +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 B403E411D8 for ; Wed, 25 Aug 2021 09:19:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eJa/GAZDHpsSMYF4i7YhEmGUco1KKsdyPH1YZouctCzndbDgceYBjjlAG7WqM9RgUMRQI9HSakMtAferXs6xHEdm758z7xZqS86dsZUqbwuDBeXpU7ecFLpO1/t3vi9GUOqRtLuacswyFVruuIpAVuxSqsypGDJ0CMBbBl6ygSCZPpb8ps3zlg+IZw/UPZMVBY9bV6MmmyepAPJz/MUraJ0ZQUP4zCiWTsnaM9x9Murklega6wK06l2zb5mwbgUshPuH/bgMDRLL/DQBEh+/x2ubg+yyoA/H2DgbqktYWvcU0ID9aXk1dZ3cVcux6sQto47P21/1S9KHYE2b2/9R6Q== 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=FosOg20NNxMgIzlohyQ8oRm3YZ7qzjnxz/qTD0K+BYJ4U0O6r/qzV6Bn53FAz667j/njZh1hYN2Hd8AJ3ZsnPaCXLaEqnnT+2AZAPBIz3PDLDGF32fZfQ/yQuRuPbqAzIZSX9CTqCsTqm4mueRnaIoSJoi3TGyGCs2JtqeDoy2oJWBTxwaJJs5jZehZPVUPXBMxFLCa0OKJIetZXDbXmPtUoemOih5jKPAbuNgsVvTXfcwNjhVNR6kE+ss/PKvBBS1rxSbddh/CeTtbldxf0LjQKM7wOPTzZWd4iXBw9+yqZJu69oE9zulnmx+9qU3xxsJFoC8u6i5fcWuiR7YL4dg== 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=eXcYqnOl/Kd4P8Ub+mxNVTkufZH3iI5nObKbzZudTE2nH7QTJfvww7+q3cPXlSrszCfUvZrWAXTfADn1Ve+BrRnZUhkV4f9ZM4AeHcb6QAU4xNJAYHs2PDC9r76UKtqgAaG6nyqQgFCyeaFjLCJTbb7eREL/TcKmKz7xz4id3oI= 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 DU2PR04MB8614.eurprd04.prod.outlook.com (2603:10a6:10:2d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:08 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:07 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:05 +0530 Message-Id: <20210825071510.7913-11-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5faaac5-ed53-496b-c03f-08d96798a087 X-MS-TrafficTypeDiagnostic: DU2PR04MB8614: 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: Nu0s7h8xOKlVOBIzGvv8hz5NvTmsV3t8vxJFtBlpHSTAP1mn4cPCTkAiy1n3I6fog37h38a5MmtkxlAt3jMkfWK9I2ZjOar2V7ZdQSSIdlSkqTpqxszdl1NgaAYb22++pSQm4iGvbxTnoQqGEZw+eQgUK47VSIbE3r0yb2ibgzeGA2qg595RzGO00CAMpeCWqWKwzVIzeC7LDDZXLy1lmR7OZyEpf5h+gmdr+PL2L+cQI0eunPPZzsC2FC4H/KJOpQSI57SyI14eoLryJsZzd7hbk9UdTau5OQAimaBIqMznVaCUUy6orLFtrpm7ZByd2HrV7A1sodSYfgkdfkKytSbCGmdg4pQQ7R5nE6TV4Dr4X77VXwdjHW+oEl1CNuqtkA9m82ElscQjEmvtH700PeGIVlLnXyKc84CpQS14GfdcrmgcdCMkUjHu4AaOWZXWTP6S80vUZKk12YbnlQIYJn/X+jo6TF3zAsZE1ICFlocy6EEHXMPvxPHhA90y462fxtIeGw7OzxL6E5RVA9b6d4/INNhf+SAtXv4AYI9uMqrRMEdatjAkkob/GOSed0TrOz/cqJodBXKgLiJz1odWkkEjd5nufUYtY6TpwDN6eBiSWGtaKAC7MUuffrbx3C1eKVO/NyHKcsA/abdaN8EoBf4VNldbYjtoe9fK7JPqJmrcw8Jov0rabQnExQ0xstZOXxAh+VxtADIht63jhdXL6w== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(186003)(83380400001)(6512007)(66476007)(66556008)(4326008)(86362001)(38100700002)(38350700002)(36756003)(316002)(6506007)(66946007)(1076003)(8676002)(26005)(2906002)(52116002)(2616005)(956004)(5660300002)(44832011)(478600001)(8936002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d5hPZ18/+8vLu1ZkVy0FRNvgcJJywH9hA2G09YWAcpokuui4JwgkHD3qfhkeOg776FD05W+wpw7G+/RMM2L+yhYZR9/8os3Vl1pFPoVbTOwiGeeFWlvPV8dgjhWcreE/XNQmfwYOhmgxjZqrJE6jHc895tUSFkflii2ubSAI5q/tzeatEadGLWYUFNr+8Htvukp6VoPpvYekOGNIde53kPHWv77SPrbITsRJxTaP0D3D1gLdLj4oBjMXyTjNLZqITEZ86dsuDt4T0PaCd/XnEmQe/jBue3Yd0RH22+UqTfSBatlT/cHFYDVLp/QILXi9Gr+iFxYp9MlSjzpwXIYAeH5XRkWSnnhUZPBwlnKlUIgeIN6ESAlitBowjSPhhn+F+3W9Qu+fS0qJaXVqoudX/ZzDIw9ui+1ZxG/qc5dE4tH8V9HTvj6Xx0phQvh5kLIoMD+5sXjSHklhlB7r6VTgrx5kPWURNWmMSMoN390VYtGQK61rMqWfSW0wHp0Ury7dqxz1EfoFrAPc2aN6+AbzRcts0fodARA4EUktl9gD4x08/YOh56tZ8vHO8Eut0xVl1pgSE4EAJsT+Vi4rZQjULJdrfYmdIS6whVrAhQYd+a7erYUtKaqdSsCeyWXS/0FM+IxybBF8/FpHotFCOoB2Nf3PBuzyuXsdL9i8WEbvIeZXLgRfAl5SiKy0flWo7KZBx6o3D5mYmI/fVSueWbMvHOTf7k6m0+5Wz45c9SVPhZ7NBGGYmZ1yTFSuPY4HUklq0mVyC66ZACSmcCdG6qY85MDgm4NfG+TlId0oEoQ7FcEeE45i/7cyUO3UflrighvoEFyYXrtfXKxNCUaYQ0rRVLxRSrG0F63CR4VwCygAWymohHuA5XrPUl8kLvTaZso+ApA+D17Su//s8v4Ls8Ulyuc+LiPMlzdJhs8LRLSh0u3m9EL3hCsR13JT1JaS1LjfUsGI1bmiwJZEdnXucTAyzYOsdi53/XUDe0ReHgeOvkYVIjyrh7wGnwV7QxvKyRy4JxiiKN76Qk3WRMi+AkRu+kXmUJ+OlxlBB0eltwZZVQnnjyjS46XdOXqIgysGBnIPiM3MEYwnLXsHtdRK1TdvtnP6+6PUx0j/H9RTExTyBiHHiyH0v1Kvo3JGfzNyi7ikA6O32NjKocW/8ncAwEqzS+T7eQagwbgLszNLFBR/wabvD3HRUyy5AmXBTj3ESukQW0I739PIQ2wnXgtYVTxW5/qBoolNvgKg/JLkWHJo+D5HNFdofw+V4L3esQBvc4EBcZoFlkJ4GsWhOSP1r7nQYY2PZrcZhowerdYnLJcpzBiCcOB+pXw1RDBPnJAZMSuL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5faaac5-ed53-496b-c03f-08d96798a087 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:07.8603 (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: xLhDaHuxNe51Yaa105MI6Hd47Mnv3ryHTodLak4zms0NVvBnIhP8GWkK8/EwBQDtyoKmdbWJrkmOfmURCVDnvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8614 Subject: [dpdk-dev] [PATCH 10/15] 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 Wed Aug 25 07:15:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502242 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp345916jab; Wed, 25 Aug 2021 00:20:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwktyxDO5xOtWBn79YEGWgDi6gRl05nxPLqE45WasJ1ffP3rqw4lBfCScH6SANSbIPdp71n X-Received: by 2002:a17:906:9747:: with SMTP id o7mr44736840ejy.486.1629876000735; Wed, 25 Aug 2021 00:20:00 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id b88si16891538edf.504.2021.08.25.00.20.00; Wed, 25 Aug 2021 00:20:00 -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="qyx/W3E7"; 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 E440A41207; Wed, 25 Aug 2021 09:19:14 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70047.outbound.protection.outlook.com [40.107.7.47]) by mails.dpdk.org (Postfix) with ESMTP id F0D40411A5 for ; Wed, 25 Aug 2021 09:19:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SKeHbL0HMptWtcMwtzsvYjYVwmN+riKPf+6XQNfsTrlS9Nlt3KPvca1KMCoLyZN5ixA0PKBAa8cKPqo/7Xn+K0AmYmHl6yO1JqWHNtsZ0Z6VVQBF9NbvkBbuyizEaYbPOb3OfzhXJUKMPMOnMqUWm4n5/ygc2CA9O/m9WQqXmD/YGKhB2RB6bic7343raZAKoPyDIxfHO8SVsI8VfdyddWUZCqAHgZqIYOUzdGuTqL06YIr19E7G7g8wQezTczEUCnvJw8ISgRu/t9xSIKYDDuzJMn/i3yAK6dnGdsfBu3kjgOl4PqLAWrUF4IM/qWMJzjYlMqjJbdMRMRwPcDjJLg== 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=ZP7wL4YNnokGw885y1hS7rb4eCVXcw3eNUOv/IZOtquK0RjJsy5BssNA5+IaNN/NfiK6MBtXZpJMqf0SEEeasK4wDk8vOAjBnpEi+HsDKWr3zZgvsy5bNHH1WgiI5fjjQcqsDVnhTrfJhph5NEcndA9SDpcev1LDP5DaRkQRGR6HJ+rr5D/y0P7Kf7dwwjRX2Br/VtWlfHm0DXqC+1kuX6ANLQ28qmqxMn8bmXw2pox7j+ntNuF7692T09yFGiwkw8KUC6wNs8EK6wowzxQEYAl/514GxGDpNmE2qubyKi9n8l1bbSW8JLOMwpwMl9SN+wspq6K98hHvBLpBcqwpDQ== 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=qyx/W3E7FOg6o1qtLf65JfHpK7juYkHvTuR9GEGCId44WgNytvhS+iAA7k3S41clOyZLcq9DyDk7W4joX2auc+48rbF1EQlbZFIW3obT6ejrmFeoPUziki3kVA8DnZTatZurnCqD8kPrR7YWJkgGu3xgVL7M4FxId251Rg3JxoI= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:10 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:10 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:06 +0530 Message-Id: <20210825071510.7913-12-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b915251-0479-4aff-00ea-08d96798a1f2 X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: 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: xQ9vMH9Z37iIgmeMGVLfdNMutjdvKkzwMxsbH+3IzWoAfPq3CC+c3zoHr+nYWCnOBpOQ6JqMBAZhHVPfnrMKdip4+VR+gD1bcHNw2qXwEa522pAyIS+oBNIt1sjJHPxn5eC5WsUBSSGpDNWDhK9mUhJtbj+Aq8lRt4MwNlEuBT63jvYwCmFeU0OS+Oc7P74DKxMweJViy0U+VlTlL7tVVYvcxEtV4tvoCtBUyYZ1hC0p13LblRaZ3+Kbmc6bwgGjDHjLST/Xj738SwnPNCLtqx1+VdfIyID1jv/vwE10cZNzXrnc0bYetzl/wLQXBgeNbhqZ3xeLwyH8u0/nwvWY0R31Je0Hi38Dfi1UgK8KZPhqItlszl4JBVGHV+Hs2ZjRm8OXNVroO/M0JDoL7fNfSYksxfQ0mN+vFtQpD1v6bR6hqEZqpX+D7qqxd+Ojv1vNHQRiUvYIkBNpiogoQUSCq0Rzo/8lnyWPX1qMpia1xTW6XnOt/4C0jy7mDPIPrM6MSuBfjc/jQQ6aAGA1/Tcw9IAylNEwO48AGRW3gpvwDwigEKMvEYChaMc4Fy4detLuvuAKIQ90gaOhUqTWEJBz8/nL8hukHwVl72KSLYMp2m3t7okREoGwh4C+2XyEw0baFanUb7To/i6okr91cbehklsbLKFxLBBw5D4s67Sbrn/zwDhqGm+b5gh8zolJwjH8p1PHVWrv3QhBsvaJodoDNg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(30864003)(5660300002)(316002)(8676002)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bv/3TvwscEZCqs35Ljs5lHid6CSPvcudDtQTl8YtXmGGX1sFHfN5qKcqsLE16HNjOt5TnxRvFK/GEXiXaXIbGQcotw5+kaMXnKjqErXolx4MAaeSFquJGbOH6wcLi0HEKo03sDZUpuIwaim7xKTWuQvDtYbtT3hzVk5dBd1z/+thCUT15vmS7YStuWXyMn+SLX+GOg0uPa/wOSgVr2Q6Wump5XXBUx0B6whnEsOsE5w1jOY1vNP6wqMhhgo4nHtqjvSd9xvyP/fpsBwVT0+xMEa8clFHIpb5v6VObqchWlmo9S3W2LPIaej0IXiNo6PZ42Ewm+fPoigYsAqvE7aO/Oqw3g2uro+ylaxks9Z4VoQD8Ewf39hl+rZsHyOYNEWxr/Qx14ZLCSGp/54cO3jOAWnbmxHod9E79LvbQaQgtE6R/+YcKS+J69P7CziojFdoUpohx/Phbx+XwO0mOKpObZWTIPPgGl9y4DHL7XdNn634vrTaU368jEM9aP9JBZHbRMZJYfGH6X5nSmqlPAVDFSt0YOzH+GS1p0DyWLi7qa8m8C8fsPAdzoESXrpUraEaElj7lfN2yPwP+VwCXIERMihnmBe7AhvNoWXGGAru2WKKsMFfDN26o23tocNQyjKUc8Sa3Q7WGe2DNU2X93TX9n8C3+4bZ9iNyb+6E3nl+k9SG8tWqhf5gDEvegzw+JAdNLi2NyVZEPRlzUvxyumEW/ayq/U0QYrwzNBft6M8RDWPK7uUIkbBWlqndtwVtALZsZq08FkY1jeCH5GiW6EDm6NHINq/VNJQSiFoUh6hpD9g9/CulQ2FeKMU90IrCTHBF4MC0fMw6TOV3Tf4G1jpQHnzevm0K5jDNZ1yucT17iaXTvt7RzQspsUTR9nqQzKt0/5gdhFjIh/bYqvahbX6i1ChnV79RO+5lsxcYtm4qKcnN7YYY2oCskD3F78izHNXlo9KpGm2VQs2MrxOmns8GbiMelhr+MH32WjIPVcdOLaJwQqwSockaxy/Bnhm+/r1ImEbVFT5KUiyEI9/5xkh5QgLq586zvmoNF7DxOfIlkxTxHcBL8VDDrG6HTJgMwVDxEQwaNXOxnEqRUIRS+r4KiXBmWneymAsq2xsz4A2LQ3Hs5iM10dxG3rmOsR/eqFTrR2EeNdB21Hils/Ii3uazZKLes5FrVoJ/EHKK3HZZblu2J9e76Y7AISGX7TXq6BIfAsnM28W4k63SgyhH3mmbIgI5xG9NxTVO8PpyS5nCJDlfv1insUzJGVi76zJPdMUJikeIVddbEIza3RJ4fnyvnF9qXoo/TATaOjC/t9NgHIsNtnV3OY27/HaG9iB+NOr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b915251-0479-4aff-00ea-08d96798a1f2 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:10.1099 (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: fm/T5a/PJ/6ZKoCSyOG6TwBMVMu5SP0pRAmE2pZ0WnS2LPeHXEAQ20hOFXEprsfHPXvU3eKsXSGZLmLAXD3yMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 11/15] 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 Wed Aug 25 07:15:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502243 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp346016jab; Wed, 25 Aug 2021 00:20:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpUWVHuyCHU4KtEjOx/kC5vw+dgZK2ozMxrVjtTw0jfp/N7TQw+Lq2m+WKcqgmpwszgfKX X-Received: by 2002:a17:906:b745:: with SMTP id fx5mr23709041ejb.515.1629876008774; Wed, 25 Aug 2021 00:20:08 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id o7si3546316edc.530.2021.08.25.00.20.08; Wed, 25 Aug 2021 00:20:08 -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="ceGw/3vV"; 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 99C8641212; Wed, 25 Aug 2021 09:19:18 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00065.outbound.protection.outlook.com [40.107.0.65]) by mails.dpdk.org (Postfix) with ESMTP id 1476540140 for ; Wed, 25 Aug 2021 09:19:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U4v4t0WjfCKCIhjBNbgXZOT+ErpMamu1LpfwDb/85ZMDNrFz7EFcANiOMpFW0UtzIFIaunn959b6sbvazj7Bf+0wueYMFnkn/LPLZgvj8mNcuQAzluugHwHg6oeMEq9hL95JEJEKf/PHG0XBve3CwB1dc0gaFPTWzrLCGhD9iN3ftq1ZO/Tgd9VXITmFB+/BZeySUVPiRNR3cxIcPS7iz276ekCffAytvUoJBIT0SgXfjGz1yuQE+Ubl0LlYxjQWAmLKBqMcP+kvGlPseDFUCruD8jB6gm2Dk+brHthEpARoWgZhHyR+tTUdYbdDbWefbUDVO7ogzA5pLPLDtAvn5A== 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=PTzfImz4x/6olLxI26y32JsXMM1dkTEAtAoLq0y2SIPSJeT6QDWykRX88W4QyVBpz/+CUVaqCZ01pYLnKYPJLiOjIdTU3oC2+NsymRUn+aWJi4nd1kPEZ+l4symWvsKdCoXR4tdtFv4BdjHLSJemcxNGiQPD699AnjvROXdE2Cy6+/YMu5QaBQ8v0DycEZxD1RSu0W4GaUctYHelQc/n+rN4uagyQnTawj9Ew7bG2/3sZy0mBhx25XPTGzsj96FpZPN+VKgVgp3se9nbqSwCN2poKwPG+z1XjuzrKs26Buer6PkKvfMak2M8yJteMV2Wmydz4cQ1jc2yTqh1E2CEgg== 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=ceGw/3vVwxlbVJXEberFqKVTSXPHr9jomaD+teJgIB0o61n2J6oScZZHVeG3SQOHmnh3AQ1nBrK7FrNw6+iyLpJafDfLA8Kvr52mRiUw+XEapQ2BMM09vQiGx6Xrw2Mnrs5tmUJtjnCnQvHJWPgakAQP5QN3kJYSvKEBTOsJkIo= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:12 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:12 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:07 +0530 Message-Id: <20210825071510.7913-13-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aab1b1b8-0314-411e-d199-08d96798a384 X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: 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: WHcjxJN8S/dHAGeyn4XiJddsbRYTffrwfeZaYPnZx5t9K9Df0sEswNZuxbR34J9Zz0Qx/BAQ9+SYZA7my3m2W9/MqQkTWNUmGlIA6+iduEohcO3h725WS6bjIgYJj4S2oaiNzFzz1HWyX6Y9LPkqjZbOllRvYqX/25oxy3hauHLjDcgBI/zXlm9Xhf6dmX1HY85IzM4u+KZpbFEs1p8mz72k3PyKRMNrRlU50iLt0pBoiIjpe58nxQU3QxwbLuW5CUPRCeN711PTbCTbooA1SryyAMxE6ST84hLdwhosbT9eSpTyiOiu6prBie6yVwi4vxy7VorhNhkw1RbpsvCr4gYbI7+yc4YljWdFhArrgEYdqkdJYmPlXiVS5q2CK7o8mY/lQithrzgpqglc3/j07yCUMNDawAxBagH4rMYqhDAT1tvCaljNQBKLMjWuZ0lBpa73E1pl5O21GQ7JBytPrmp0EszcJNU8PfXqHcsA7mA4wCiwv9zbZ4etf0iyMCIl3zLHi2gWvTY5lqaKLuXuNFZ+dOQnVfBfJHF6lH66g06OG9Ogu8tyUP3rGio0dkN9wW6kWw0kLxwuTOcl0bELn2ay+m4dWlNJAztni+32zSx4IF2pXK8+cMZP50JVpxvkWdJKeQ/7QVv5MQcSMZ/5sX6PWMVh0wksHQHsv1zwfY8qNDTq7BxreOa4HvS5Mbi9gbgScr4na2SLqBB3/ZA45A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(5660300002)(316002)(8676002)(6666004)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BW1b5X4oDO38DXekqebAlkVBlUmYMrP/mu0L78MuQZiJwuqY/cuJieLBaCW0H0TBQCoeqVHcmUTyS7EpHsEo28kbstcCtgUOgOMInAxKjn8uGqIlmutQoiFs2zNiz1VrUD6eHqFx2E6oJ8PQ8BiBH8bpwHEAnnWk4A/cHsLezsNvtUFWMsVLo74MqeGduYY8wTK0Auj+myQovo+ud2Kqa1o+9FOxrNyrORcFIbTsx7QJg7nb+llV5As5klt9KDvyuP2XH8J6NxP+8sXA/S/pUuoEGRgPFGfKwddIUXzBjbhjdep4ZmSo0jF9v6HvsHBIWKLSDji6GWv32cSQrLq3dx5XqqkHGCJD8GAqpnq7g1e7ypRc32s944JrIPE5m+gGJankFat1QItVheH0F8Qqf8ef73NQHhg3S56XeYoZMlMMX6jvjDLLzXLZ3NbMyEjvvSgSmjFIEKw3nTLoNimhMRY5t36x5FURsYMDB/qzFUs+kIfY5SyTxEHGdUW2uekt8iTYXnGIhErwNxmoQqFmonjgoe21QE1l8fh57T5MdZ+7oQGSvrTfLvE4Qx825NTPbjUYtb4krNs+zltr5wwsNrdgspNHLDXovSy1OTTR5Lgghm+AEDnRSCM2gjfGwKd0zAKj/PxQ8TfHEAIA57NwnULorBZUybl5IJqA7fvRGVgtBz/5ocpgY1t2sbn3Usf6OeUOXWNaiz9ereKtyUHYYbbN44BadpV6f9b3F+YQPuPGxadwikXQP9GU5HK2d5AXJZLvBgMIvkJjHlw6hTvjTzAlzWMWv3QlkD8Aq6qFg9+Db6PYz/KpLcBhudUJsuxLlhWxaFKCf2OaNBWlcArR5mQcmSVPYl9ZpoUYcPS+9niOh6xiMGoAS7oV3n7dPoHjg3AyDBy53fmEk+gpV9Qm8LgXHJfqUTEfPUW5gap5THwDkG5uHPlOdzmY1RhGMNEYOmc7h2l6EYyd+dqAcZuxzKomN2ruHrK7LNMgDtiEyREIkFfOvRQRX/dQDbm1luBE7iw+p1JzoJa2Palmo5nk5eNlKXk5VraQ/ilcRtZuSw4qfYBRFCK8D2/5QJeH+Ev9Rozx/kiBGlAvYwJ3pmqx7ctVKwqOxSNpiHD8BxC2cFyR+/hfNAPv3KDGKVoiu+bkDKMWS/i99/To+bj1QP7F4pc0KYZGs89YL4TIlGwq15YteFChBJl4C5/QOlF7OpfzDeQyQzuluGMs2Pd3M0CAJCeSykm4fETnyaEWxRkYTbLlLnqMInHK/quvufbDdOLpEUrCLYWJExqm4n2O8x+fwPP5OldBWUQx4UbbCSFBW6WlIjd5r7/pi5svWcjEvQrt X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aab1b1b8-0314-411e-d199-08d96798a384 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:12.7886 (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: yRivt5UB7FSBrY4G6pQ4Qgmc5ZPNgTZUM+lZFbHvaj0TOJSTnrLJTd2klz29mb0xtwtkcMlW3NINbRUq4E6smw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 12/15] 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 Wed Aug 25 07:15:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502244 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp346095jab; Wed, 25 Aug 2021 00:20:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW5t41K6HlCMiCbX1idrH4WMdnNl+QPr/maqwVgtH6D/zX3zC8zDiXJIfRVewuZ4vMVE+C X-Received: by 2002:a05:6402:520f:: with SMTP id s15mr41140228edd.139.1629876014374; Wed, 25 Aug 2021 00:20:14 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id p26si21656860edu.78.2021.08.25.00.20.14; Wed, 25 Aug 2021 00:20: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=kY62+08q; 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 E3E86411E0; Wed, 25 Aug 2021 09:19:19 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00072.outbound.protection.outlook.com [40.107.0.72]) by mails.dpdk.org (Postfix) with ESMTP id F416740140 for ; Wed, 25 Aug 2021 09:19:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RgRXymcS+B5C5DfqQGoiXX+bih50o5+HkuTzId28NBv0GS41cOr3RylCRJbiWFm9w9jBIZ8ufgzvApsPdQf0bjFpQnLQUcnfyHMAnIFU9KTljj+n+6vfUNjFYhQghmB2NFrRaXgP7AD67FSZKjvOgnVn3J9Ld5MGIem3s34r72617quvxp3T05j/rzn+nhWLeFkBOijiCXzOzm42Oe43EbNiCcwITYkVzzkXpVf4O62/Wn2l2fDe2gSJ/DUGqSoBIquhWyFVhSRaQZv5c/HrimtCFkT9rVn5ZfxQKaGaLJfjCvVzyVjvyzY4FT+2wjFjrYEnsPYYTf0hHKFi2lDoUA== 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=GR5Nvn5+p3rppCv0ov0xhlZwrIlL1dkDuX9szJgKMROcTgUzlmwbFXXqo5M+325m7B6Uw6U8KvYq+lKXTHjeFcP7tp9HokdOg2hELKYxbYoIFK7MHvWczO9WcN5mZyvAz1bFC81uqDzX371yZKEAJzYSt1kRgXxThlaAVb9sefxwomyBpePS4Y8oAUSLhNYw5p78GDZn3ZRcsiyFwFhyyodg59j8lM9JsWrb3j6Fn71Ack+ZENWvD4u7pT8itc0E9PNYHE+GBar3xiaQNY/yu8/PHuFfNrXxYARqisn83k2Bdm93yQtYfQcOvl787wmMfHo31Zy+wCm4seSjOvvhnA== 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=kY62+08qDt/YaZq3KS+h0YYK9maAvkdsNTkhs5LMmBGclcWMv3qRu/qoKA+3jBDyE9+itARZr9E0yoLGShx4xia/Hd7RWvFG3sPh2T4IUjEZa4P5Et55VGrlWp9oz4aAAUrAYEFcyDj34GnbSfJwPcgbC6jZqoJ7QDWUcoYzsNs= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:15 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:15 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:08 +0530 Message-Id: <20210825071510.7913-14-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 197ebe44-e411-440f-68f6-08d96798a4da X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: 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: tyN+qzGf3/IyuApv1u6y6N9udSe1cTNZ7OSgrAj7FRmyxmnDWbeirenRcBIt7QxFRbbrFmr+5BjL0k1sduCzNprTexjKOwOQ42e+OZd9VH4CbmDIuydfW/gzlI6h2o05FK00eR3fTMwZGHrCD/mu0KpZ5wzvgneflddgEki9JglRa8cB/2eoDfIttST/2UnMd9SFSdqGM8uGjGgAFAJfxP504qLpCk7FRWx9nSOJExveQ3r5YaPctEyKsObsF1olFXmOTKfHiJ64w3nPtuwCNFtS7oV9ekYbmeiPXhFBZsX5OUIp83T3m1B6ialEOclQ1riAJu4pCEYeSe4Vmg5IZnolmdjSMQANODPDSTalyMbHj9b5Nv7s6NDXSbs5lugErEXPuqUjwLUyFUOQQI1Ygp1NF7t2a0/Rpyy2Ifvu6cHhHI9TMCdaORUcqJZgAw/sICbBOpmLkg/jmNSjbuacfbXLUyGq2VTrBFShXFCqlkHrxULfrikZ82Sw5lxnV2M2KwqTkNcepdPCiHV7A7Vp3pGp2WmSTVGiS/XzSMSjv2Kf+PxkHrpw+F2IznajQeYrRafnVVu5mwExUqXDGQMgz7OYQWtg8BkKN4QlTzLtLavO/eARShOYEWKbPsKLNtSsf/Dr/pfYMZZGL/GGLI3gWcVuqDr/IMqg9LxUHxTY6uvEFgTBnx3TjRcaLDDlXsz5Fa9IuqZcwFmYqAwLmaHDFA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(5660300002)(316002)(8676002)(6666004)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 33DbmDdtzt+CDPx2ki9I7vfKgD4HowCSRQPKTTEnQI5oOIxSUxXOJvvKTtxRHwkWNGWyCqGSi5eOkQRr4pPJmbYu82k/bq5ndFd0GNFBTlUFVzqK04UQkkfpMECwl2pMVtYlTL0U7C+XPwS8cVa9KXk0XlU4KYeVwy6xEYxl208NXB+O2dFAq/KhPTjPIFx96f6l/qjZTL5bREm6bBoO9f4qHRwRDwJ6KIERKhMdCO8LmeLLZAYzcIjh1+xjRm+WLIDdBg7wm9PGUTPCMTqNFCBtNJDj+DXHkJWcaHePV3fZaWajpJntpgJe49dVi1kIdKNFNLzJ+tgtG8g/rFkMtYrk3r8s2ct25Z79WcVLToXc2uiEi9C8eax9f1qToH99HaGU1yMfrJ+TDj8Ueyy31iBX2FEY3QSWMAXmJrUqahxmocmphwIJxX+xpy2OI0d8e85MdBV2BCh/eB4SaykWMwAW9rTl/qZF5oiiLD7kSdL8bukHYVNwynZw3v+6MKlJTtgDDW42uH2xmKq4nY/LciPbL+62bYBT6Om92Np5P4Zr2V/JLV6KN0h5zx6KU9ibm0a4rywMQWKt31PdjfoZcDpnXISkp9b5jVUzSiENzDJbYebrNtL19Fu2q5xbhwovDBb4nXOm+EC8mU4K6e8HHQncdL213DsBjkj1kKgr30+HQe2SqvI5GlK0zj60FKn0mFax5id2S79dM91uiQEZ3cj98Rf6ck3D55iaKVyUb5y7fmkWukLZUcKIkAuBp0M0nqJNi97vQmkwq4D+16y0kApisOIieyn0v2wdJs6CaygWwTCbPau/5CDEVMoTFRGQU5oAvgXoErAjILx0BMmE/E/tWmR1v6JRaQxFDqZ/ErxFS9N8zobQD/1GVCuiOBbe4rEzFzllYaFVTm3QKX7mGxDsphCD8bIq6QvCxws/VCR8ng2pEWyV4WIyLAs4v96XmReOyHMeDEHq+BcdwZzLPJ2IzoRRKTSKo8AonyVaGJH4TH2n+j0irlri9QKCN4B/gv+l6egWHLLEwnofJ+ivDq6Li8dvOLdlRuCiPbkQM7sd7SftPiC+dj+qgvxZUgoo0h8HDMWzzZtTTkcmTpZlc4zjcVCuQxE4p1nxNfbjBrUXxTE3M/pBV1RS1tTPqOFiMoFVrbY85PyvUFwyiq60d2MGLt6cFrcMadZzF4PvU/57IuoTYJsb3dVTJ5sr7XG/VHXAqZ1QzYLMVtHiZ8nEQOUuNnzix5979mrRC87vnFOjDNunTUgMbsQ+eqjVd/LUog9cYHv4QI6QZiBkzP71UWDoL6H6eQn1flrZTPqGsgpQNN7xcFpU4WyxNf2mtIku X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 197ebe44-e411-440f-68f6-08d96798a4da X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:15.0059 (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: FwkA5kr10I+CD0nXP9BxgRN6s9L7DQSMCI7WrP9SZBJ8OZMMkXEEg+3ZbM97HPui4kd8KNB0QL30KV6m4ykNIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 13/15] 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 Wed Aug 25 07:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502245 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp346170jab; Wed, 25 Aug 2021 00:20:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfGxTFso0kgdYz8MG3SGZRMXNtbGdIReNpOsVCFb2pzHslYV7ippB28PAeU+akjEMp7g/A X-Received: by 2002:a17:907:2091:: with SMTP id pv17mr44471833ejb.204.1629876021376; Wed, 25 Aug 2021 00:20:21 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id ht10si13287215ejc.30.2021.08.25.00.20.21; Wed, 25 Aug 2021 00:20: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="ZBZL/IbB"; 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 B00424121B; Wed, 25 Aug 2021 09:19:21 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (unknown [40.107.5.70]) by mails.dpdk.org (Postfix) with ESMTP id 52EDC411D0 for ; Wed, 25 Aug 2021 09:19:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=msyaCyBdNMWUXxmo5uWDftom8F1tyU6Y3WtGh6WzAbiMGJV7x5lHvGUymm9KHGWrpfb1/naF5bzVz6S8IxJsw6o4S9KFHi6vESMZfoFCTHTLvGXLSYXflnOKrH8dDY0ybu7WB+2w+unFsQ4EnKQD5tqKPEVlb81Ai00XVxr92o6eC6nZGNzEEtykzRLgxtAT26vLT2pr4viFaKiGlq/0AdqsNjA/G2hB8lUXcVddpewKt8lDZg9PM+MaGxiBuv/xGrXbfsf1GPFGuv3fcKHMHyoJ1Cm9Dhg7syCLA8CEmV7W4hPWXQBE0ble3/vTPJ+ujW2BXCQt7/F8O5rd2QtdhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pMJNO1dkwlWbM+LAvtz/F3D+6Yzd3CJPsuGCZQpwoI8=; b=joZy8qfz/gxZut1DvXTizaeaiB64k8XxmaQryzUCRBzD30NQL1pFETbI7QNp6tWxfZCW7ISd5Ef8mYjfS5U37FZ4HhY306RuRLQ7h1+ygOzVUjaoSPDp29YcH1S7uTjfoknR0l0uQv2YOC4BEkI4w3+EBSJ65ablMBd7ji8073YCD4HVvB8DfOz1bU+KSuinRD12bWcPrLWmDvFr99V14wI18bdnQgtYa1BdQm2ttxPfpOBp7J033+MZlsqWAmqxpGzC0Lz1iDMJ0DeEsTxyXccXK2yfdaRVqaO5/ep9UcHX3YG51mr2NtcttYFpeZB4+f1Vww+IH7ykYDjr/iQ9BA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pMJNO1dkwlWbM+LAvtz/F3D+6Yzd3CJPsuGCZQpwoI8=; b=ZBZL/IbBYzovRpUCOqFTY72wAeLCWudyTXK3APJrf8YOwNU6S09ZBVbE5+d1OXKA+/+nCJkvQO0mInXemHQvZkCg9SgG7DvGzdbdNVtLDMSGqP1CRAJaAORMpHQg0QSGnIT9Yg41QvXoFCJQy7+ugPpc5akKd9VMfg4UnZuahig= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:17 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:17 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:09 +0530 Message-Id: <20210825071510.7913-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e205c1fd-e318-4585-8bb9-08d96798a62f X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:469; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l6fZBehFxhNIqfMPQS4+/lWWmSP/zbpRWXy4EGdn4MaTjdpYs2kYBw1uCzJz4HKj7lnYTiYyIR1XYuR7NJhjZrhWmPY1sDsBxl99ZW5f+7yIB32BwHJRvnI1bpFJsf4kqhEn/4Jzi/x/iwEl/mv2l6mmYp4tIEte0aaAG45y8l7lZp3vWHwZZ5t0HHJbOm8gd+fSj8gSlSVO8J+VG927o1zOu6N0jOcwHzsRD6YfcJYnVWN07FOA8r0qQgIeJT3kUdYeuAFsUy/WnetbyYB9XiN3JHB5jFruDh+XLzjlaL6ObuaZVdA/jFSaxg4qjD3caB5DDn75uvB6bU+jEH+TLAu4o5TPo4hFocSkMGylDBiKmGPQ9C3Q55e/SaW30uA0sCM80KBBTYkJC4aCCAutE/E0B1l7zHkZfl0VxTUUv+sxwUdcb3n1GV1m6B2JETQyOJuig+FxojFzH4FkmAz+E1/ufLAzlsSvXvmcnGnUPX5yXpfNCOQlYWzoQpiGhGTXGDIt5Hcdi0LFWpQXxNk8Rz2TxB0OrvELaxeibvf6cMVptY49AAyuZglKsMbGcVCbA5e71uu5S0+THatRm6LoIteyTcKQfrEUqUodV+t7B41Gtq12rlQhDFvAKL48xQPIqDIhpG8gORpTPWD8mcSg6Q7jRYcANhRh6ste7xa2YtJO6MUHMqo9/h6DwrLnTL/CjTKZW2KB2GGnM3zU5Yim5g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(5660300002)(316002)(8676002)(6666004)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ya2+5/zQCpR+e7iqmprZKqMROkPxQrJXmWbBbFSt1Zvx3Mepk3XKVASk7w4dEKcie3qk47aILGktTnWcHZOR6oyT2CteTPFsheKRJWSeaeSqgwvxKptc1uXcsDNZEW7KR76lOfT942SU6JpdnWAnlF6AbE+Xg4zLH4NtPZ947Z8KKRnDCAJzHlXladh7eK7daj+jbUWvMUVzwxBhXC90pmUB6iUKU7kuT8hEb92EjPpVLUOH4Grl1tKJZhM326WsAW/Ag5yzb3FKKYyu9D8987FdSseYL3C3clPPgTIN9v9vrpEGjnV4ED6UiOUOcLvLJCFAYrUsoq0cLvWugNArYa0K8BcJUESGo+UgVBDHtIiUbdXwJHyjJdT2Yt2LoteggUmH9GqZX4oWqGnCXkgGk6stHU8Sbkx4q5vrqg8Wta2jLUVE5mGzKVJPS2e4UzMPwjFXrVY1baaDpU9hQGFtThqXv9PWviIesOhmBUzXSH0iWx0hA20iIc7d4oqsuCwGDn6YDSs7OvW/0AohZjHdCQquOqwkeZf4r7dMW9naaRDlgI/KGsctB7Ksz7lvXRD3q8rWPY9TgFrLLj4D9Y82xfPZFeRQLQyBwQp/btKntlBJpAz9DrZzexD4QxVhAO8Kl3/3O2BQec6EeNelXBmelYpjiSpAukEiJ26ncSOQ6P5ydhwVZEWSuWDWI59+ObYgxcxifr9hgwprKtXLmKapXqZhZf2LbVT5xwu5DpDdJAuTMHsmRGRvTpwsjVS4WxkaJlP8btyFIGAlquxR0UwvagzPYxpE1RPiUjfEUxLy4ud96sviKrcHTxon7BIp6PMT2XTTh4FLsK0hoqxgNYh4YgokxVWSgH9SGBpPgzE1/Buzx1c2kAMXbJmTzgkzHYIRi6fQOwByubVwOPmsgpKd2qLaftINXByi6YBhOCskRCWmc144igXojPkw/sqo2Z3Em1AdOMNPMNnxUCROfJEfM5EVTslk01VR8HgwnDNgvIcTmmOM8ZyIV/qsBq7T8ahHFTs9OnnA8VwEdRKN+Thif+kr7YVUwzX9yFlVJfX3aqlRGtXBrKLBRjwUjdEOUcvfBw07J7ne/IbZT1y9z+iUidEwSRhxNBvavW2ggPtypV32XIvWTTI12hYoyxjABM9+T9ksyr1Eqj2/nHmZG3Slhrq7pEZUmXqe8pjzdkLYGDFljSh213EH8oAtRUwAAcirDxK0po237vHGLJ2ae+En4UJ+H9O1wMGmw9HczsNe2Yxwf3j+tyFic0FLmOjS/7xECo98+90XBwcY2NIA/kmfcnMB03XYjdjaFGe9cg2VevsPEchYTo34CMHmeG79V9lL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e205c1fd-e318-4585-8bb9-08d96798a62f X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:17.2226 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Pu6F038GrmNDwqO5WI47lZe+GLi1ZnatYTpvOHfi/NTedhn0Y1muSxE0L7LZnAe39dN2osHA4dtyR9DcAjL5vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 14/15] test/crypto: add raw API test for dpaax X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch add support for raw API tests for dpaa_sec and dpaa2_sec platforms. Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal --- app/test/test_cryptodev.c | 116 +++++++++++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 7 deletions(-) -- 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 Wed Aug 25 07:15:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502246 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp346220jab; Wed, 25 Aug 2021 00:20:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK4TbBYYgXKB5Vdupfa3SNg/0ksbplHeQ9A7OlOdI8KzxV/SylxH5eH+fLOOMaMwD8d9eK X-Received: by 2002:a17:906:840f:: with SMTP id n15mr3954588ejx.460.1629876026433; Wed, 25 Aug 2021 00:20:26 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id n26si19665134ejd.436.2021.08.25.00.20.26; Wed, 25 Aug 2021 00:20:26 -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=JZM196kA; 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 31A65411D4; Wed, 25 Aug 2021 09:19:25 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (unknown [40.107.5.74]) by mails.dpdk.org (Postfix) with ESMTP id 5EE764120F for ; Wed, 25 Aug 2021 09:19:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qtpug9u1GQ27p2OnA8ejpSTscFpXVBx0q4G1J4gO7cTIrJ7n6+8Lz2GQaObRiYbLhsmNTkfQYkbaLp7YG/npJr2R/q87pbUyf4QDDR59KjzMprji6Px+w27clBLeMn9YLIltxY+Q62CdaeRTVQANCBakQrYLDc02q26a0pkdsNVIAKe8t2n61ldG/xseT6f0rVAnfd7GZoaG+dc3EFJ//gQFh7PyT3BXLpHWUBVAgRXquH52Z+SPQKjbuvURIeyEcIxBOjUnHKl0v5w9OUbuBHAI5GuHa5LRv6KVYUwXMiSIWHwpiGxcXNAHfhFFwkF3y6Dp8h1xHB3wrF0fLR7QVQ== 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=RuLcyTSPUZNMY2rFJofW3X4wUqiL6TG+sSjjCHJxxZu6PCmelahcvDZIHLRYThRT8JhzMhJqaRqAhEMKgNTjYu/4IiXml6pFbGfyfaT8dVi+5tdaJQO+UgHzY3539AStBN2RWueF1uIp/up+ZYX/p612Gt7sn7A69zmM9R3OLXmm2S9VwEAAlAAMM3p7mYgw3Z28naqzZ2hDR5ow0eHNzTc8YJ006I+iqvsC+qqXVWDj/2Ua3E+0qD672LUzab7ylNeaghxuzClRcdrYbZaT7tUyfLDaMh1ddbYj/hFYxMcOYHL40MQ8+/h5MslzLl7FbOqTYtnJexcZSKoPYAKNEg== 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=JZM196kADHJCQe+cegCNuqIxZU1wmsi8EugOFetl97hICWPuJbL0w/wh2oTS1BkTtFvUABpxNZ09ccDpj0k3LVSbALhsuUnBAtKSoXjz3CSoIpzWisulfScJ7ikD8kEbo66bvYy5TJFjq6uZa1SUAuPGHoxjj5PVnU6+j3HK5Nk= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Wed, 25 Aug 2021 07:19:19 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 07:19:19 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Wed, 25 Aug 2021 12:45:10 +0530 Message-Id: <20210825071510.7913-16-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825071510.7913-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> <20210825071510.7913-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR01CA0126.apcprd01.prod.exchangelabs.com (2603:1096:4:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 25 Aug 2021 07:19:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 40e9f647-239e-4988-f26e-08d96798a781 X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: 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: 382/rVCyO6IJfFiiQI4TdiaTZ+0DC1bXKAii/2XcqCG5d1fApnqAhFhBxXSI5CWdFLmo6K7k4OLKSDo/U3ug3uSgguG1DqwkIvN7MH5uD8PvCNQVN8N7rUPbdNWq1kvTcM71hO7kHblvEVL8yUynmXOhywYRdrY/t/URdDNXsy/dtZmsUl3YqpX7i0b25a8PJi+fte77lNMXOZZeQ49/uIDp+kPkwxGouqPm3zVXcja0D+yBnI7bfk53KNyZOKlAoeM1d7BW6u/sbhRD2JD/PNjFpras96dB5QzzOibalVvyyfqOImknCG2IzZXsKCSm0c7SSewsiWoJZLFiRVVYc8i6s4Pjz9C6hg+pUbERRnzWSSOUBoVRM1GkGyRd7Bunm6ZMt1mOiXNyZTQXW64HVzD9lPwbXfs1MLDXuAEp52I6GJCVi0Qa4Fi+OU2aLh+5eMg8Lzc/qgMOr3BgqYAP2RPUr1ScwSu2VE3f4dyWywYXYFW8qAkFP0Xhyji24irteGuJo4/sN1T7Yge1TtIPqLneI9BQ6o3qlJ8uTmamiEfhWW21AVwZTskf3Pw4xRqzHuBPlHZnx1v/pDvG3jmGhJPz1vc/Jifb0WpoWSKY23ueBk3Is0Q+7Bmke6KFaFh5YJ3NjR2/4QC+IYuIDkhec5S5GUlTFhOUPdm9qUqMRQnLNJHf+4FsSxamndxyVicz+atfWtkUoH+m4s+aqGlusA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(5660300002)(316002)(8676002)(6666004)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L7fIaLwzY29SLj9A/TqkJoA4OtzOr5nEr47a55dgZwjdtzgAJRdGPUhXEPQhjU9eDFQBszb8hcVjt8BF5JIGwU6NII7Z0opeBVsDkXdfxpPJh4nIoW+lAxPzfUDTcJSOdGTGBK0dn17MD0DeCqWOUNWDcMXQABQZdVOaiwQYXUQ9cedJuFa9bgKNhOATnwyLYOT27z/wxUElZt/BPERLxAMAKWD7PPjfmCS9yM8JbuOlh5jOZkcNdf2D6Ok1sA38jh0JS9GgdLjGpvUkCE/ISi5sy6qc3MbMwEumtuD64MD8hIsbtyEgvEZBzu2IQtvxsK6FoHmkemYfUrWnH66GToT1Gl70pwx/MmaELN29bYn2cpzHbz4uaIOVrEmQ6ehZQttIQ0DQLRKk9wj0c+zApdg8yhFptfK0ClvThWUb9V0REdpEqInx3d2aUGtFj+ZLK9faxPbCamTa2clNM5FuaEWKAD30zAcivEEJ26JxOcxVwR6zdXCjRVXkCb+P4J+sWb0nWNNaIYFNzSUEgsn5C5Ju08f/V83tMM/7E2OsOPi1mE8sHYEB7ztpoRq/8zKJMXHKtyvrp2CgaFfn3GnREDC+52Lstzf6Ljm6AdAZylv8wgmBDlSdqgMeYtAcZ0UcK7kAmWxEzzXwJNZJE1EAYtkduQiEYn5kfcZWZw0xPk+IcmFFQVE32z24A00F/OstDVlIuJyZGYxkgMNVTVVD/up3PtdrXUeFuuEsAUzDdMpRoO8tiE5nb3645ZIS520qaBM8VxdDoEtI53AdRAgeVsjiGZH4T6BLY4XX1rMx62W6YtkIxPm/Zr7lx20cr96lIk9cH81RVwkjpyG6N4ADLV9cxREiOOoDfHrptTrEoz+/tyJbwHfCjHM3kcu4o5vFwm9PdrH5bPkiB9kAqZJhsAtG62f8oY2SjHnaa24x0N+SGsRwHnQPImhhNHEksX9Pzb3dw2Y92EsgPMZBLoam83jMBJL4cA9tlhEkQC48Jb9zIvM/poFDW6Tqf2koHu9CfqQ8yiHhmW4n/HS+omeKgWBqaTDm21u39WNp8jwa6APAvQPh2GljLUKHeTzCQPfTt9DZZb5FndFIwk+1O7uT5A08+GdTA1RCk4FBSTYDqa1NLxMKe2UTMN2rlUGUpXEcscwkgPCOZrsqvQNwrkkt89FTJFYrDB+AkN5f77pkdoM9lmpdyA6mciq2KarR1N54WJfvja5/T/Rpdr+ZSJEacsadan6c/8zu8hLDQKEfBhpsywXpiGufnEp6j53GzJhbvVIc4djN7lFdCxe2wBWhuCD7ZMo8yORDMGRTGY+wKvv85YxixNwWK6y4rUJTzq/a X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40e9f647-239e-4988-f26e-08d96798a781 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:19:19.4508 (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: mgg1ru8xRSJ20YBLnVNZl6PGHRvtxUMQZroks6r+7vppz67p67uRYAagsaI3PGL8oZSbcRg/yciKpZtJNPDWbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 15/15] test/crypto: add 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