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 0C26BA0547; Sun, 17 Oct 2021 18:22:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC1B8410F6; Sun, 17 Oct 2021 18:21:45 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20046.outbound.protection.outlook.com [40.107.2.46]) by mails.dpdk.org (Postfix) with ESMTP id A6D6E41136 for ; Sun, 17 Oct 2021 18:21:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I5WVsLOn2koDPD//pE+wqMuOYn6U+3iBU2lQvFRJrM5vrDfxooMJinqGGSPgXAlUbsRg62suYGTelcEGEKcoZK6sXq//zs2d2myU7BzWsj7hlDKpF0JwADdsJZ3nVEx75RBoXPgI1M8QPH8mWKaVnAkQ96avRP098epxsA98s3T00ndxzKoVvnejtHOgUr7reuM+ZDWLU+Fdzdwyi6bd7GEhGqPy98xiT4sT5/+BPEksE3CfyN//8E28xob0edZdFGuU3lzEXvU/llunc92fiQZ2tI1JY4+zC+ZWSNnX4kq4jqsLaM1icZbah9zOCDqc6BcQPiEXb69Bd5bGRgozbA== 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=mVQ6j8AbPufNfQCDDmbq9SruBrbc7HFwqYVM5khTvwEVAxcxNoEOWpynONU8QyIhHYPO94JbvP6oQ2zuKKz4xxCjcpzsvqB/Vx7Y7/9fHIzZLiqtS7Ao571C5Kp2C1qqKOqjMvlspgStatZHnFBqFu/z+hFhBdu0zBC1HUzRvOvND2mk+aEw7jWJByxu/APvUUHC9Jc46CApdl+klqeRczYDyrrKRLeL8SKQoSlW0MPGWoYr27TXw1eS4FU0ci9pxJR1yJ9F8s8/sYd71oiS+ShcorbptXbMGd417nmOazBXYkLICRanAmasv3U4FAwCcPjZRWVMhj+tTssdbNjd3Q== 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=edZEKBJerjGG2d7H1p8kfsbaX9qedPtwLk1/lLwg6orNxDTNXSiVd1CZpvlzt2eUvkOoQkpIzehIo6/HPJpAXi4YSZjd+C0gQQPmYVx2l3+y0mLStWGNjHC2P7RaBexnqCC9+LAXRy4gF2MLZr9AwabVjB5ijBWLDXHvZ/bFuCA= 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 DU2PR04MB8615.eurprd04.prod.outlook.com (2603:10a6:10:2da::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Sun, 17 Oct 2021 16:21:41 +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.4608.018; Sun, 17 Oct 2021 16:21:41 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: konstantin.ananyev@intel.com, roy.fan.zhang@intel.com, Gagandeep Singh Date: Sun, 17 Oct 2021 21:46:44 +0530 Message-Id: <20211017161651.9220-9-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211017161651.9220-1-hemant.agrawal@nxp.com> References: <20211013190032.2308-1-hemant.agrawal@nxp.com> <20211017161651.9220-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:4:193::7) 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 SI2PR01CA0053.apcprd01.prod.exchangelabs.com (2603:1096:4:193::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Sun, 17 Oct 2021 16:21:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 79642803-54f6-4bad-2728-08d9918a33df X-MS-TrafficTypeDiagnostic: DU2PR04MB8615: 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: RL32t2PQimyUnPGffMZ6DDQqhfAf0kPQuyjibkT8QlXw8bYSUMIsL21BJs4HdW6Ebx85nnE+Mzv0OJr5LRhBW3UBlDxYcfXmt/pHvb7RuSL2EiQl+YmTmPQly6AHmsjz6VX2xKlG1ExDhvlaKic165NN1KFPQqgGz7+HHwuvVlzfYYQ0ipvfZiKIOlFxuAP/SeAzh2IZT9FZgs1eWBFRkq11QQz4jzczB3lDXdJ1JVH34tXcaKVvlqo9A3A1yJy6amEqpGnMknGzX4vrjK1LT8NNWhUJznWMgKY64lcGkDDNfrW2LrZv/GE2aGHADagB+ta7ariYbC+IBFERKqcz1zi9+Gt4kfXIs7lcPZq32DT9yCRABNvBI+zoYz1oEMA6l6jlaTKwdrS5By7hGvCLO13Fx8aH6DavJwrIt1c2yv6Ta4uOKraFRQkFFQYDyE2/rCie2U1Jfm/ngxaG0OzvVs3HCUBbHUo+VUlZChMtl8LSahXxeHz6T5LIMsrAOYlugZnzq1yr7b6ffXa3dKApui95h5fEeYjKx67run4ftO01bqXTqakdQwntcs/8nBOXw12r/wH/y/lXB9biQjsZFaGR6v3k3VNxDmlgkCP6uSkKzZgeqdwUySp3JeAIgcY1onS5V+/x6zconAWIkMKUXlX9zzvFz3hi8y4Vve3oCZPSDg5aCoAlj65vSJwEco9lXYR+zvhurxLjYL0Bk2lg+A== 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)(6486002)(66476007)(8936002)(66556008)(66946007)(86362001)(52116002)(36756003)(5660300002)(38350700002)(8676002)(38100700002)(508600001)(6506007)(26005)(44832011)(4326008)(6512007)(2616005)(83380400001)(6666004)(1076003)(2906002)(316002)(186003)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CbQLAKy2gFl6JAR5i/ZW6SlMvl+rXB93jhsolJyz5DMMcPzTPQ5ynyWOAl+Y?= =?us-ascii?Q?VI4dcdAMV8J7e5sL5kJt++1eKsRJ8Y9Ng+ZaojZL6UnnaU55jI3fQfKFOmls?= =?us-ascii?Q?i9E+dZDRON6DIe20npPgOCoc6bdKrfUGxMohhgoccnPodtAsO4YX7wKFgTHi?= =?us-ascii?Q?AOkeUpwGt/Kcqf43BohOhsSUofaGmB0ImI+ZdT5WQs9ewjP3NY/jvcfllLQB?= =?us-ascii?Q?zgaaFvUOeam6ECNobVrPMTjIF0WNzYHMsLjaxbMx6lAQG8dPDCJUXMY5lAFT?= =?us-ascii?Q?WGKcV0j6JslMccyAg5o+fOUjjVuRy7srE7XvF27HZFx1Fru6+ZtUUiGaoUB2?= =?us-ascii?Q?SbtwntOHxyuB3XZIQ+qkbAcgqn0aH4KmryNil5eINemXrz6RrkgTnbnQfQFI?= =?us-ascii?Q?BnzHm0fUeZEpZMYBoK8IpmHj+plB6HTY4oKLW8Wf1MqF8+iDNltiLY46OZhk?= =?us-ascii?Q?TTaVBAnfpZT7vKLGsLWXHMjJ1VXVgJ+k6Lct0CiYRe0Er6hexGNxA2OweArQ?= =?us-ascii?Q?5NrA5j+dcdAFIN2rEZ500W/jZS57WI24UNsFgEswD4V5uPJ+J7F5I1f+odfs?= =?us-ascii?Q?4iOe9PrZIZt9ggMmYWoH9Sdq7OFZ+uF6uAkjdJVRDHjhRAe+GAQYFOuINqQ1?= =?us-ascii?Q?Tnf+Dr0kYrXFlE6yA12HpCbGXIyXe05CXhtygE9FkA/0WOO24pIT/Wxsb5nT?= =?us-ascii?Q?njS0U6qF6ErTMn9iwRGM4/o+08IMPu6eLDlv188NmD/dbli2Y93Ot5djjulf?= =?us-ascii?Q?+1vIZ9wsZTNd+cWtLHmewLbC5R8E9w4fET5MBVmC7QFDmYFnoqHdKUEMNUcU?= =?us-ascii?Q?gXDbQ8nIh4aD3dhCeNqeBxrOdQ6IRmUHG1wGpS10rT5vhZezNO5Vz48y9R1Y?= =?us-ascii?Q?RnKSrapqu/4PxTfuFY5PFSh1SMsFhppLpLX/b/Xd2FJZ0QvkDNe3aAl77zvc?= =?us-ascii?Q?3StoNt6XU1r3ft++NKqS+3VKAIt26fhbzNmRNc1bGeCmAMM5cc1wmYW7FHQv?= =?us-ascii?Q?5W1o53dMkQKfKgsk/lmmc4u3GlDlV5dABti6O1MUmcsLq7mcJ482uUDKp8vZ?= =?us-ascii?Q?YnERzUwKObNm2N4x+zSQAcEWWKJvHWsQEjjZPamZluAhbaFMSWL1RCg7oY4S?= =?us-ascii?Q?sh6mx3Z0Q63z5SUfn7VGA8xWjxF29DcgMkzunac7Js749o0GtIx8ngQ/KkSr?= =?us-ascii?Q?1frHkzgZHMYo+65f/XGnGM/kihY10xrD05uXK4E47ZMT2ahpMs1dphyOllqJ?= =?us-ascii?Q?MxrYSOdH3STAAl7Er3sHPj3QIXxhhMy4EmUed+Xo1FRtXGDvJW9uAIaEWDg0?= =?us-ascii?Q?gAAsrTQkfpbIfokUffK6hhNU?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79642803-54f6-4bad-2728-08d9918a33df X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2021 16:21:41.3752 (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: H2i+FUswV+AT/5cju5sXxJT/ZAvFwjIBzMnHrMXNIoz9oSH5EhxWitXOM3pjPAf3AQdNeJQy4svJ94cvCPxgaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8615 Subject: [dpdk-dev] [PATCH v5 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