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 8700DA0C53; Wed, 25 Aug 2021 09:19:40 +0200 (CEST) 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> Content-Type: text/plain 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: =?us-ascii?Q?YKIlJk1yNrvwhn01I4URj5ToEZad/KRlyI365U48qW3DJJWGLcI/HTSgax27?= =?us-ascii?Q?hglZDdhha2XjdjHKOwgjFnz3eFAfbCWtrzlwsmTzZHWy55K83f14eR3vjtZh?= =?us-ascii?Q?2UhLI88RhK0bPZv4Y4B39VxqQuvy4jt31B1AlnQlKINq/tqt2l7aaYsKKuDS?= =?us-ascii?Q?jLt8LEs9VCv0kzITINQf20ljHo49FWtUWxEOQZEU8esVZc/v4IAToboy3ZE3?= =?us-ascii?Q?30Oj9PJuDQnpSGOxmlBTHnjSQK+tEW+Onduv1RBkWzSn8lCHF8OIf2eW8SyQ?= =?us-ascii?Q?BbJBAfhN3v/r0RJu4xdDhhSbiL8h5X5xX+XSejDN1CrsU4P14uqFhy4CnCfH?= =?us-ascii?Q?fQd2XckTi+ACJwByZJGwKi533j7e33bspR7X90kNLrPFe8mGTy6Ce8dwW9M5?= =?us-ascii?Q?hUo16Zql/2CuJcYuYSqpyljn5a6O7meToZWSAKahajvHQCGfOv6PZJLbcbzn?= =?us-ascii?Q?LAWsvfjKJ6l+ST1nnOWjVenBzgv48BB+selNWo9rZQmCrBwuL49WCONC1cT/?= =?us-ascii?Q?vs8NPW/7bMtr9hy1CCp6n0ugGkj5tyTCndSAuyUHNVMJLByXKLVy5NRBeY56?= =?us-ascii?Q?pp+2Up3XWySZdg2PGGAIsNfx3bJkJ0B/yMO9JypaGv/mMp9VAzXEego3lqyo?= =?us-ascii?Q?4jynoUUutERxCSZj/ZMflr/HmwWobeQOxLPgcBqN29yHWdp5Y4dWE6pV0dFJ?= =?us-ascii?Q?97bhyXlJFz9/922/5OeO7LzbjU8EsR22fU27THSxAQeXFpsNdwr19YSor1LJ?= =?us-ascii?Q?1PFj6xd2dOUteAZrtLWI10gFURz/M4gl6yxZw3Jta4MMSKwpswuH9+ouaDcV?= =?us-ascii?Q?vVhtW/9vzYbrjVUXPk6a4MXoly6RIbVYxd+xfTWm4NgE+b02NtaAxAHvJeq4?= =?us-ascii?Q?PykWiH3Gxp9aS0m8pJSChG7h+zwwicIMJoB0KxDa5gdCT8VD6303uus+Yg7w?= =?us-ascii?Q?u8jiKDNxfOkJ1rvQLw7oZxM4Gv02d8XnUFKox+1v8ACv3ecOu0EJguc5spBH?= =?us-ascii?Q?A3pqEsy3xapqW7m0/VH/mEy98vLKIdHuk4l1O/AZ9WfqMlfIzmd4vswBU2mW?= =?us-ascii?Q?i7BY4UM6YzxJP+xgsZzQCCx746/YEgs5cufUw/dm4r+jhnNLpqGB3XPRpWFp?= =?us-ascii?Q?6Iystqr4Vkf/cqfhof9YAANnttyN03hfKtWioojrG+jzEwg9q3myN5KQ45+G?= =?us-ascii?Q?I25kJkhQrHX2mup+jBSehqkE4Z8f+syKA6epsvXbScmNqnQ+zlpIk90hmC2a?= =?us-ascii?Q?N5bJveHBPOVK0R13iPJK5+XZ8PpWiiRvJeEVOC7OfvJGCi6/aVvc0jCjfIRg?= =?us-ascii?Q?qO1Ho3xrThhaZ3z2vKIseS4O?= 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(-) 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; -- 2.17.1