From patchwork Tue Sep 7 07:59:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 507510 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp4012620jai; Tue, 7 Sep 2021 01:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpvetWxkF+KtaQ1qV8a5o+4+29SNTxB1/WNjd4nqacEJ8yLxw53ciyJOPj8ceizrmQa3pe X-Received: by 2002:a50:ed0b:: with SMTP id j11mr17085591eds.97.1631001903620; Tue, 07 Sep 2021 01:05:03 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id m4si9927073ejl.583.2021.09.07.01.05.03; Tue, 07 Sep 2021 01:05:03 -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=O4T3fFg6; 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 237CB4115F; Tue, 7 Sep 2021 10:04:10 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2058.outbound.protection.outlook.com [40.107.21.58]) by mails.dpdk.org (Postfix) with ESMTP id 255DF41150 for ; Tue, 7 Sep 2021 10:04:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HFdJkRPjQ7WHY2HTsda48VrLJrM7hMKa0ZzK/uHkYzL6LX49Fi+qTL9aKnt71XReoQIDibv7nynKCXRfYnlhiQ8p6kyDDMJiAOOJgGoyhZcyj6/BS8xX6dp4Sm30zz4RUbioSi9JBhbas9rm+czPPTNrrorsFsV0eBScm27Du9H4RYdF/BvOenIHTpwSlZMJ+cRWjL/RV4nZgrF4Az1Vbyx7eDnROnb1z9X1glBrXQVFUdJ2wKNwq8WDp0EcJ/ry1BQS4p+GbQyh3Ez/IQs4jVz/eHsd/pwJbuA3pD6+XabB1BqkmE6sWybCdyO5TL5y5jFvgl75mlKeYhtT7TgHcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=cvBi74HymQ5TkmVd+LYI9BMAoQVjPMPASJqA0hKuS3Q=; b=c8/N1ZcbcVzwPD4ETgNOGMPq4poCOXw5/YYco6pWNceakaqXNOuFxRMTgq4BlrjYKs0ZuUV9bx3Hjr3K3sHO4/vz9D912jPEHX41aIc29u3Q+hheeDZFBW2MjlogE5SLce5eh1e3qQmFwkYToUYSo1pUQOxB3OSzdHOw99hNcqOoIDCpuEhd9rrBNjfTbq4nmqNaJ7YAqOl3b2a0RrBO7fih5/trvfptDEaXy3hQXVXFnkfSW78dJwAFinyb4FE7qPOkBuY5gdNuLxTL2R2KL2KqM83l4sjH6x3mXXPQh1FpreKyxdTi9lZuC09la3JEBpShs4hHjbsxNEHnq8Ke5A== 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=O4T3fFg6L/9Hf32Ju9ml/uVTYorGj18gLxMEnCu1rhOyhiuQ6V+m8k6KWlw0fWB1uIl6yC/j9oTWzzmHmrmQ7gruLMrYAfOkNwAEFh7xhDdTpvWUZb75lz+AEhYN0v4K0OYgFFgIlCDLHtliZ/BtRq0xzVo9aTdKn6dEXk2uB4o= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8709.eurprd04.prod.outlook.com (2603:10a6:10:2dc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Tue, 7 Sep 2021 08:04:06 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80%4]) with mapi id 15.20.4478.025; Tue, 7 Sep 2021 08:04:06 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Tue, 7 Sep 2021 13:29:50 +0530 Message-Id: <20210907075957.28848-9-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210907075957.28848-1-hemant.agrawal@nxp.com> References: <20210825071510.7913-1-hemant.agrawal@nxp.com> <20210907075957.28848-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0068.apcprd02.prod.outlook.com (2603:1096:4:54::32) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR02CA0068.apcprd02.prod.outlook.com (2603:1096:4:54::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 08:04:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ced8a3f-63b4-4b07-6570-08d971d61071 X-MS-TrafficTypeDiagnostic: DU2PR04MB8709: 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: wKJw4+8jwYGwcqOgfoav8/omOw1mQSvybDakqhEMf0Aw2n6i5PMBAMZvAawbdN+Ob/q+DoEAJXvSgHCpDGd0/DoInJvmb5LQU6OZ2K09pTKPxhE/fQz2dqIFVhGynqPzP8E1J5MuMTZD7S9i8ce1LpNSYYbB9MTPECtOe0mWzxeNP8KcATEY6aF9olxdqZGD+sT+Y7LWu7m7ToUwvsYWIxyBmYA5iv/KrXuKmh4vE0DAOlu3qG/MrLxD7Mldf5otQsVD4oDdo5UDnk6D6er8f1IrZsDFQS8KS9rRNCsyQv5/R4QsWvI+ojL9hJ375OxjrZgCAUqIY+haGigqSfyePv5uZIQEWi4H14OtgYgX2Q0/ErIjs2TnoGltXiNWF0hmpCzjC9GUa751RqhwYXgy7m2DReAgIr4JK8haHvUYlc5TshBccti2bMmk8iKcD1ELop2YthVxGiuTXpXy3jP3JBonAJQIR+rjB2qyWH42EsEBTKVhxqf0zZ6TCelMaBpl3Q+lG+qxuyc2G+ItLu/w0HXfXm8AyrnTOt8IwBUa7nN6Jry9Jb6cNcqFAcFtTgbD4YSG7/aDK2TnS1U6voBh7mD0lccTZPbnVWRFNf5+qGYvQySP9qz/EsdktxYuKVURHPsKixASDgaEruIAHxoErgryFLhA0uMQIXnFik9VTKxxlrSoyGIFAFy9uiTXkiZXY/3QnpfLvXF/8ypv3+XoMg== 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)(39860400002)(366004)(396003)(346002)(376002)(2906002)(956004)(2616005)(86362001)(83380400001)(478600001)(316002)(6512007)(4326008)(52116002)(1076003)(5660300002)(38100700002)(6666004)(38350700002)(36756003)(186003)(26005)(44832011)(66946007)(6486002)(6506007)(66476007)(66556008)(8936002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R1fprIY93IOJHft9m3DvVep+DrihQjRf128MxskX2pQ79Ou6D04X8oqY0yyU/cySx2PUKWeY7QfGilpDEadeldxPjVWMujyylAktFZ3iM50hMaoaS0SlB5fOV8uvIY7tqRQOPA5bacj/OtEDF2JX1I7cdJ61+9dAtDoPv2OOXmnUD0XfDQnbUuBZl0IDZPl3lfOiO2uuvYucW+X99DljoYAkmTm2uePCn/turY2Ly/ELzF7Zu3T4a5uVu842uWteC1jB9wsttucUZDiGU/uSX2cFzu0cg7iy9tKaqR9LRsua02KtfmzbCA6DSBWnQGKnpfk6uKFFb4R9ysR6/Fi0S7giE+9RMkRbYqgFhsB4ucJLj/3SdFXDgPx8em60X+vjasKZ+j9JvwQj8o/i3L7NtK1fagK6JBWVAz8/RSeeir7jwlUDQ8izOt0ErGo2x/a8ZM+zkfXmjVTXFzmnDCRZvEyUIGmQd5gf49cjkgzfmkLR5x1DTl4FGpkpBGyWJw/PNG8Zphh1cRge234xsKAB3gxJNlP6Mt8rQ0V7CA0HS5jYdf2nnOQJo+LTwjX8QcMGTq7Q0cx7l4hAtzTY1XPmuUaZVP84ZmlG4pFhqDJimBa8xWO6Uy8AOwRbYlU1vxS4sUV+69D8BtdJswYuq7Otmtodgrjt4iVBnDK8De5f2lsf16S9364F4nlP+6VFVQt8dRw36b7O1JdiEt6sOBH6NR+rK/o64B9KeOJABUjGev/4XGLrRXbjJ/eXgAB5cnA+vZrVci5eVFhzstwIvyqLz0k53h9FAVPFfz+OYB/cklu2UheheFNBShin+XvBB3CcwxN7ElFBU8SBkmhaaRmtuyoD1AzDd0FD2HLBbE/9sUCLyFJq7dh6YOnHvfKILxT4KME7dmSBx2pIRooH/BrOrgAS1wZ+3cowhHb8yZeH5QZIrhLUmnYQQALu06DtS9EapXICoUpraI1fGGWVuZOM+XBbhBVX0y6Vki3Z0XSnQ11jJar/hegdcBBWwPG+zX79VNyCpjXJDyBcaTngIN8yAUQckinrYowYG/co0Bn7fiJTVvst2jNzGvwX5nMyEZbdqnH+epuM8ev0/twIpGCnkWGhP4TbrM4//dW4xXt9xO+kvXMEzzVvQsk3U6iidFAZGRaZUgJiT9bFsDb5SwEjWh5TkMW6YmHb7AlVuyHu6pzCoRF55+K43P7dDR2R/vCp2FtEt4FzjNDuhKffdhKojIqqN821UJcF50cw4daSGZ6dHxXLjd6nZgb2LbCCZf9jSxXhQEbSKSswrwZEj3V8TX/UjsuhEU6cil/5ydfbYEiw3FdF4lYA7P+Ljdg2j1vi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ced8a3f-63b4-4b07-6570-08d971d61071 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 08:04:06.4324 (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: SwjRn+NJHqXxi4mTpjDh65AhFawPhn7jlTvS/tjgPK60msoLeHRqGmYc+pMeJmDSvDFIVgzxFjE7O9MtPpV5Fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8709 Subject: [dpdk-dev] [PATCH v2 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;