From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EB05A0C55; Wed, 13 Oct 2021 21:06:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C97F4126B; Wed, 13 Oct 2021 21:05:21 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130070.outbound.protection.outlook.com [40.107.13.70]) by mails.dpdk.org (Postfix) with ESMTP id 168A241286 for ; Wed, 13 Oct 2021 21:05:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ji4Wd5Z+nbYgtHiascNRFFzGt/CazQQyB1KWZ4+Fs08z0sRlR2k0I7gCpedNbs3V++YthlKNxCPNBGrFmxztkniW/6ecz04U+FP3WRbdnh7y5p/MnkGIvBJ6rrvlmtDcysBToZUmA83jMDdByrUjd/hSKtBBBaDfT0NVXjCkstrC9xPK3/qHzE4y4jJsHbulvJmBEMok1xoMwuMiBScWF/4djtK5pcZiZ+75oPe5iIgiTXkRdYwbu3aIDUpy5MUXhjpDPUSO19yZQDFalxfKE3K4Ph5J3+5fib47V9+l9oCOBfV3F0DNlViJ8WAIht/N41RsM+3QUSIPfvHk4svCvg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+UK5bwQfxBf5X+s7rYuIvO4N3Q0epIAaFc4+jekprfQ=; b=PWyMhNVEK0SH+PgjfVQQi3mOuWqyUHWxlUWkPmr3p9IJQG1lmVeefTYqgAKsD9e8+mOXAxk6sJ6x65Eb2rsIJnmqZWZAHcNLX2/xjZ5eDGVyC3mTA6CBboz87oAH/yh1k0VNNcck8I0rIFVuKUZsvxIM0s2mtdxvUv4OoT2vhqLIbe5yFpOZuGsf2W+gb30qDj10n02DhEGqNswsYToil0t0o2OM7u89HxXTkBmDBXGc7+Zz5HkbFNQFeMbJEkBgBy7sVadRRQWzIaA4gkapxJOIQJM/ZdLi4qTqSVtlmrWCwwzdjDISnM9HIlO6gb9hIH03kNVD07sttNUIVvpScw== 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=+UK5bwQfxBf5X+s7rYuIvO4N3Q0epIAaFc4+jekprfQ=; b=ZtQk+kssd+C4+aKyfPmguOEcIv3QJYRlzHtfskL6Nr9pn65S0o6fikur09LWVaROd9bSqp+GaKpARFDGQMDGLH+BLaeMTRE3GPUiJHU/kjaoTJtCCalZIBTUsI/ZD+9nvxPFKql/4yoRGMOOwhmifL6A0FXwacEjA70LYCnunLQ= 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 DU2PR04MB8870.eurprd04.prod.outlook.com (2603:10a6:10:2e1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 13 Oct 2021 19:05:18 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::945d:e362:712d:1b80%3]) with mapi id 15.20.4587.026; Wed, 13 Oct 2021 19:05: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: Thu, 14 Oct 2021 00:30:25 +0530 Message-Id: <20211013190032.2308-9-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211013190032.2308-1-hemant.agrawal@nxp.com> References: <20210907075957.28848-1-hemant.agrawal@nxp.com> <20211013190032.2308-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SG2PR0302CA0011.apcprd03.prod.outlook.com (2603:1096:3:2::21) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR0302CA0011.apcprd03.prod.outlook.com (2603:1096:3:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.4 via Frontend Transport; Wed, 13 Oct 2021 19:05:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2d1671f-41c6-4bc6-af8e-08d98e7c655d X-MS-TrafficTypeDiagnostic: DU2PR04MB8870: 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: ZyXh7gAhA4I5hJ4Hwgw9Zuy3DNpNvpuT/E7s/OnHizFi47ikicZW/0KNYPilW4bYebSrLVGCLTBjeKy+dsTPibPs1ordm7lXyzqIL/Ihf5rJe0oUBH100duL0s2aI3thAlcamVeRYbWJurSydSrDOaK9bt/SPxyL03SGG06o+nfoFQ4w/7rPHbpCkmOaJCGjO3Df2ZqxdPF+WAa/ruWab8+jKZVFYovl4XzQMEhem5DA3k7kH7JOBoqslxyy3twpXcnQW+eh7w9g+nHCpaHJ0oKmielSNu/wpZVmE61qTyk44Tu5eCNteDcorzjnj2RZdEapsHzQr2utUxDtQu9XgcbeDKFcq95ycgJ5H+2SbuuLQPrdmCCB3F43z4r+Sw7gkPb7e+mU6FbnKVdC3cgsAd3UkLQT29pIVVNaRPxVHM4/ZPKlo4a6k0F6vQ6N0BRcuuz7lDNIwsJJpwW+3Mw4GNFHsyZGXjPsatcTg0bfNkRh0AfI8TuvkwwyATyYV0FKlsPc+8F6oKZ/8HsqV0ohyXgqLvYbx8Q5Uv5UB2mcBCEa+Vau+Bj1FnV5kRb0rXeOKLhJN3TCI3CrtgJeVh+wkrC7c9g4yVWao1EhPMvmjDfqQZR8av3G826ICEi46NmjZSq4R9CvL4mV957DBNVcWjqQ+cNv4WLtMakci/0HxG4Hlv6pdKtf++36J4hvJe8jXOunQVrLYLXQqWPZ2iQ7FQ== 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)(366004)(66946007)(66556008)(316002)(6666004)(6506007)(36756003)(6512007)(2906002)(8936002)(1076003)(52116002)(186003)(4326008)(956004)(66476007)(2616005)(5660300002)(83380400001)(38100700002)(44832011)(38350700002)(8676002)(26005)(6486002)(508600001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/AoW0JZj8mkqvLalZoD5SehwqbkEdu98VuI9qNxsRC0wKxoZPWvnOwQ1bwTH?= =?us-ascii?Q?NSMRHkCJPC+zBTZAYQqdtH4bOyGx7XV0EwaEWXFbYNWa+nOVFXx0SHIIt9my?= =?us-ascii?Q?Wv+UhL0vApyX09Bjvk8KM6s+iuAPsoyBd5iZyPFfNDQINJf+7mvR/CxsSweS?= =?us-ascii?Q?I9IymYaH6xCqarFwQVv9li6lDjpJY3lchFOg426VhUapFjOLTwvqjwMh0JI3?= =?us-ascii?Q?lfWRiQZ/j7JlTYZ3qYvdX0BDLcqlxg5jrPme6acpbstserh3PB8h8imiwXaa?= =?us-ascii?Q?HIckpAjnxbw0G+kfg8gLXvx1ff4z61TMy6C7vuUPss5eyZRg1warL08nn58w?= =?us-ascii?Q?lgPhhA53/xYghjlX4txsmkLK6dDR7bmcVcv4oIXh8q04kwyLvLyJzwj7GCpb?= =?us-ascii?Q?bssVxkPPth0o59hXO7DO77zT0FxgQNBA4cr0QletixCWt6Dv304Ns6pv/LC5?= =?us-ascii?Q?UpCdalXrycUN6b3SFHh7WkhcVBkm5aZyHH1Rps0wDj4HGFL73A4C/u5B00s/?= =?us-ascii?Q?fHkob7/FvrMINymAkyaXw5zjv1hvXDmT7r9zx5xC/Mw+b2VZsxohXVzadtgK?= =?us-ascii?Q?n4L6msatQVWGcUnmuMYIfbK3FfCdWScy/asPXI6E+LPuKodWn6nNEwgmlvIJ?= =?us-ascii?Q?LSsq8sMBqDh5O+CD4CMCrMZyxhKAh8ttyztF9xjJ+nwA/sRDgIYi+o8pDVJG?= =?us-ascii?Q?fZhgk0tNsBsizjXQhfpmLdEnHMWVvckxHvDKz2KWAsQUZa0cVG+P5U+vKnof?= =?us-ascii?Q?/M8z/WDVBMP8MNrJWwTPF4lF62QavTFgMbCzj3XKdZ7UIV38Qbept1Lbu6Uc?= =?us-ascii?Q?oV3AaAvtAFq6yO3f6u07VeRbrAWNqh93GJq7xUT9Eht0/chl5J9g4nrQPVUq?= =?us-ascii?Q?yRaOm9R8gj3zTcrLOjJHiRpvDB802SVVb/b3+EOA6VNFid9tL898CMtkOXN+?= =?us-ascii?Q?SiiscW/3pRgxufa4cDC1N3CGC0TwJnampI2yLMVU+pPmyQHVhjFj5wLjtxh1?= =?us-ascii?Q?E5cg6v/2J3Ws4dOGQzRX3XYlLyNCrh6qnlDb44QxDtr6MvCrvDV1jA/TcDlK?= =?us-ascii?Q?G2YgMbCL7g5WPQBuMYw4pOOziYWX8stZh6dFzFH8WmfAskVb2/4NxlkYVlYP?= =?us-ascii?Q?eCHHLOVtvpHR8hUshNG1a+YlANP+oZdaJ0Yxy5pNBObYQNuGQF2bo54XLWk+?= =?us-ascii?Q?iN0O3FO0iT+ihez6FTRo6V4EAkJYjC82GWtcW4UNZ4H6AG5g7sPIwsSbko9m?= =?us-ascii?Q?KPHiLrVIBUd+46NKrspG8pLrMAmOQQ9yIjGn/bd1LsCnaWhiXn4NHJ0Cbinr?= =?us-ascii?Q?smmSSRqiIO542k/hlPUUNflg?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2d1671f-41c6-4bc6-af8e-08d98e7c655d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 19:05:17.8787 (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: bNakvNaA85VrNXKPZCMr2tytMbnbq0He8ehs0ldrYAkGGgaCqest3MDNi8B9HfvpYtjWZJ6Wu1VmqBaRc+ogYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8870 Subject: [dpdk-dev] [PATCH v4 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(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 565af6dcba..5c29c61f9d 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; -- 2.17.1