From patchwork Tue Sep 7 07:59:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 507515 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp4013000jai; Tue, 7 Sep 2021 01:05:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRI/FRC6T1eJOYQ/EmOl5ApTmfhmdo+VFLszlN53Zn+vzZu427uY8pgWi1e0Rc4hAnRTZT X-Received: by 2002:a05:6402:1d1b:: with SMTP id dg27mr17252610edb.59.1631001940651; Tue, 07 Sep 2021 01:05:40 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id y21si648794eds.53.2021.09.07.01.05.40; Tue, 07 Sep 2021 01:05: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=Ut+UiHR3; 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 6EBFD4112E; Tue, 7 Sep 2021 10:04:21 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072.outbound.protection.outlook.com [40.107.21.72]) by mails.dpdk.org (Postfix) with ESMTP id 12F1E4118B for ; Tue, 7 Sep 2021 10:04:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T4UaIpY6Fcf7DFgZgqselMmxFGZxmXRFn9LteYLM1vBPYBk/yz+ZI+H/e6DlNKdnwrpaiRmWowQhCsKqZ7AObD2Tx/J4GccgzrcG773tzINdpw7Jj/JkdxTnK1VM5bwgqACpgXU2ffHb8ZqIXxU95y+e+JsWbPtXQMrEpT/H7Umwowf7Oz40nJMDRn1UVh+doDd5YmMV5l0ib849HHK6PXak/WaPvez1AoDJe9DFGAAC7BNrM+DA8t8i28D9+v1cgwuFpqt3UDAGrag22d4/7uPKntAvYzCqwZDVn1bNaQCAz+D6WOjXmKDivmVizyFwh0XG+GW6RwEdw2iyM7NBsA== 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=A8iJ+j/S+ByMy8rnX+hRPOi36XD4kCFUOgoetceQrj8=; b=YfZY3WZyag0jqgRxu0slwdnzJ5Hd0QQdYd6N7E5NmIoWNGDNmKlx32YB1wrTqL85Nhe7OVNA9h0VSfstUbkOfaavAI6GiB9a/W0eYX7y4hhlDWcZKOk5XYKUbau1bkMcuxdec7Kz47nmA6o7zwscZz7NzuG/yV5D2iVY4XU+y81+W5zVz2V6xJGIfKadzsBR3i0m647AI7JJtdXriqbRUZwiqlkxBeSqZgQgwdhRWhzlzOhxvcTkMNKPyDX7GwZR+/LQZ+09p10BezJfbLBrVIJI+hLY9KZaywus8WISl6jwYyAAh9Rhnn0OqKgGwlCg1DxaDQt7lupD3rXyrwPJXQ== 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=Ut+UiHR305iceoD277lGfU2qGYVFxfQTNXETfR86NRVeFH3wPwTo4685kvSCIELrknd+kIRTTi8tKrgv/1tTN2P47XX9jVPqCX+U/pqQ3ivyh6JDLoTrMriMXgxlqDktIkGzQ2e9mPWvsZPzXPdQ58YjCjtqyefzqaquU9MP7Xs= 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: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%4]) with mapi id 15.20.4478.025; Tue, 7 Sep 2021 08:04:18 +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:55 +0530 Message-Id: <20210907075957.28848-14-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:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0d2d585-2440-4172-3a18-08d971d61770 X-MS-TrafficTypeDiagnostic: DU2PR04MB8709: 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: eknhbyCiwSoljP5Slt4Rhle0d97O/M7AoncJeFdx83JZShyIjlvs81P7PivSb6g1zMbL5opZrpfDZil82epdh7ubBrVnRFoMDsfEfpJnc4rD6HsBB6Zk4O0dBsfFAZtbnT9C9JHi++aX7kLwa8YOf8fsEclSPZ81UF6f+1BtauDI2x0MJ2NY1a2YWQRs4NMOS22+Pl4+wuC/Z1V+jPFrDXV36vCrabiYNmboGCLWSN/8ozHpTBt4hFyoaSsQEnuB8xTJaKxeTMtRjhPJQFLr0JDoypnOt+J5uGjBWdUAdUpoSQtLLeHiNFNsifqehOAZF6iG37c4HqfRdmR02HFouNRicU8I7IdT+bSYbsid3pwlZ8RBpsO6v9sTDbu0pq+HBzjzmf4+YbnwyzK7Jrodq4SdUtV7//CS7PVRmgsx+IK98FrAn9Q/gmMoaUbVjOgzGE0eT6RyPdG3zLiYVH0c1T1CkxhRTWwzovJjaZNuGGRXAovv7/76QHXI7PsB/oWg+JKCZpgBnaQ+OvtxlUglQqKHFJHgKEWaVbERziwdUDUykJVnTMHKaEs/hBp5jEfQ/3HpKpz/hWTQHqhluZp8M5jh2HTdj4LKmGOjWDH69Z78rIypmfwDorkZxQpdNMRAk5ySNCfXLJe0xZrAK7HIqAf6gSv5EiJBjH5i4QsZb1/Npj/TOz9DJ3YEqkLVnYG1EIyPgOU0X9l94RiKVg2vnw== 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)(396003)(376002)(346002)(39860400002)(136003)(366004)(36756003)(38350700002)(186003)(52116002)(1076003)(6666004)(38100700002)(5660300002)(66476007)(66556008)(6486002)(6506007)(8936002)(8676002)(44832011)(26005)(66946007)(4326008)(86362001)(2616005)(2906002)(956004)(316002)(478600001)(6512007)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2ifY7kAhRzaHQTU7iTNoD70o8syxiwXxsV8m000Lu8CxOdjFhpmqHjZbNKkcKNMuJvFnpne8uWbYdzy1rRjg3RjsatRvXi2iGF2zgQ5KTG0qCJE3nV3NuHEETxyJeIXdlW6drcswID/Gfa9g69vclDDtNX7TdCOXufUES2k3pWhtIdjNJYef6iwqE0wdjvqHIZp9NzgbfI/S4N/hYlQAXSC01FqEzgge6rFCN7KDtEynpA6QVn0kDX7c5++3MopbPalnEb45zi1uXLK1yYuNv+MVPK0iXUE8Y84ut2g7Kvd2QmZmbWdyDfqJFxdd4uP5jX8s8M/ILyf8Ac/9ZaLd+oVNYTQCjMNtCXRxhDZzMIxULQho5LrER51Ozz2z8MDy/hUWwU/ww9VGsLKLIYgKnC82L9kFThq3UgqSt3pVjAHVlC62ZbM12lv1+lEAXAIR0RL0Q4WQDeigZiyYnYlftCouVcrREJZ6b4xCQ3hB5qPjHCpe3gYcWGQMOYGcMRY0+1tTiTqw657fGX9qwqUDQ0ObDgXxHxdj+0iB9HdErPbgsQYxiylUJNOxXcncE6/ViNe5ED90XtiKNqRL0o/nsNbrSuYrkAc1eYu3gIsEe7jAocdMj1ZK5ePXZvhUCBhTDbbUYYd3TmI02zeCdVrYZ4sXc6Jm2/JWot1HqpGuYrytk0PRRGt6QPFFXcwGDYRhhz3IraV0TkrWxddFGj2d4YAMge1ITT/LtS1RtLK5jTLMa2bFK1fg9GNBRPs1OJ+uL5nxUB1iEo9F1IuNDOapGBnr5SrJkwnbVjzJtXLoAzsOjZrwRxc1LhVcnW9tRRAUBRh+01ZP9EVD6KkkRuLNR335hRSv0nNeaTGX2/35wngjbODMjbx0MWZAHWYISIP598cadaSGhKxufmojRntQsuK+rOT+y4tt+8P57VlFRtvgeVP84rCC5YYGIYgb+4nfyLLQzSVHArXnMwrmjGLg61gCBbBMNGN9KmJZCCKdKK9El+U+u3opF+FYnn1jQVgD8wfLOZAdUD6CdAMGhjdzSldHxMiQcAPipg0Mog35/W0bb5/C7Gg2G7iZBiRVH3Qjjd1ox3dcO+VjWW3k3a18FlEFaPHwiKI815yVjzYRuihFhcMf3M75RlQvFJ1B+2R0kjt4/z/9Y73y6iBCSbeJB7Om0nQIAwf7JVU93tEv53HaMNXt7XSVPExi5Xd+HefEL+IATNSF5P+gcNd9uVta5UXxL8e1wVYDpWBh14A32lTGVx2YGGrBQtiiSS0z3lcBGc6uBL7fNiVaWpXo4n4IFS0Dq28g3uI0B8+8TYtigQxVsN8wUIFCFTRHL4P+vY4B X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0d2d585-2440-4172-3a18-08d971d61770 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:18.2146 (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: n9g3dr4HYXyTniWWJ/LNgn5XOyczQullHK2q/7jgG5j0/ZszL4Tb5rxO1NGMf3xTIFi7xWD69CWSajlReaq6mg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8709 Subject: [dpdk-dev] [PATCH v2 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;