From patchwork Thu Aug 12 07:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 495968 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp84190jap; Thu, 12 Aug 2021 00:17:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4aQ2MN0PCYQKqILBmeF/NrtDnek5xjYke1eRR/IuSp6zfwK0hKyhPLXZrZ+NXYx04nkmw X-Received: by 2002:a17:906:2acc:: with SMTP id m12mr2384713eje.231.1628752671281; Thu, 12 Aug 2021 00:17:51 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id f3si1508410ejj.302.2021.08.12.00.17.51; Thu, 12 Aug 2021 00:17:51 -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=qqVobeLU; 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 C4AA641263; Thu, 12 Aug 2021 09:16:31 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20050.outbound.protection.outlook.com [40.107.2.50]) by mails.dpdk.org (Postfix) with ESMTP id 1A29E41219 for ; Thu, 12 Aug 2021 09:16:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SouKAH6iM5QvZpfYsl0TKjgzbrCgFG4vc2417IE/COaQ0e9ZFjk5kSDb9j4lIfY7ee4UatjOywEWZUaNBdp1gn/5Hbpls01tzbNQqNtWgUK/6VqwgCl9LHvseKgWt6GOZSbkmU8HIKWaBH57tEM1kGp4iUxmzmH4q26Y0AkTyVQDvfpcJbBb/Pln7Eq0OvlsxDsir6blCMkcph1H6/Oxd/W0twJTiUrAn8SMglZeVN89cksYrPuxk7T158/Z8rwTjiIWOVVR2q04o/dTxKqZiUNs8BYBZW8UEyJl6dMeZSe5IRfSzhGSeb0jcJdYXgkQONtshTSq9ZXT19gi54kYWA== 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=A8iJ+j/S+ByMy8rnX+hRPOi36XD4kCFUOgoetceQrj8=; b=NpGb3k1yDl16pxSpF1dutJ926u3ZrhJXwi9JkODJNfx0YBEhclERtSRPttsD5WtVOqsND202Ms56JF60SBbgr0vPgy1cTFBho9Phmz+QiMSL941fRnECx5IgfmXcSqaKJwVr5n4ocSsXZj27ODgDviWhOwF2UAWL/DS6m6ETRqfxzhzhOq9SXVo+uXAC8aHzAwptw7cfgyheGPGprAL7lgMxceFdYHRZIrkb4XYLn7+lDFevsYc1DSLwRfifofQC8+3JXrLZqtoY8RZSmxTQ7SP4Ii5X9dJksUpihyA2lpmWWBjxwLLIxHYTKxBTUlxhgsaLQCKbtWWl70c6tfbfBA== 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=qqVobeLUMUJ9Vb5GFgh/6D0JZi6xyVwjRGbTcq579Iuubd5dgq9ecj0q3jqzEl9o8iysH8o3t6lGwa4SC2M5OpspC5NAzGC7hBXSL+uZUMu1OzPYKcSRklmxTWgPyfBuAla2W5LcomBTmWQqs3Xq+kkR1PN/2e8p/pse9ufHMhk= 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 DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2bc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13; Thu, 12 Aug 2021 07:16:29 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%9]) with mapi id 15.20.4415.016; Thu, 12 Aug 2021 07:16:29 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Thu, 12 Aug 2021 12:42:42 +0530 Message-Id: <20210812071244.28799-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210812071244.28799-1-hemant.agrawal@nxp.com> References: <20210812071244.28799-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0105.apcprd02.prod.outlook.com (2603:1096:4:92::21) 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 SG2PR02CA0105.apcprd02.prod.outlook.com (2603:1096:4:92::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Thu, 12 Aug 2021 07:16:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69b52c37-2635-48f5-3622-08d95d611ab9 X-MS-TrafficTypeDiagnostic: DB9PR04MB8461: 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: Oxd4JzSkyzky+eqAnZlf0nOJZINBy+P+1SPM9Vo4EkfKHeK8RnWeyVZ3QX3+zYN9sBgPwh8O0Nf7QgXmBSQaxp84O26MHzmktY1RKioC5Liv4wOasim70R1q9FvO2vf07FhvNSiE2MYJjowgnwe6t6HFfk4xeZvzUdASnQqIGBhnI1pNqYfJWV7WzU8LonkZ6eSdpOh8j9nN/4URDz7yIuEzX0oSw9BEaYyEGnZdR239ZzW1b6agiPurpNllrDLCy+5zoSMGS6kYx2GKkoBkLTWPDe78eF7kDrjYygRQ0doUQvZ/srvLxL1rFAstpVehTgDkLg5Efr8j1EhzxHVsc+qho5m8EPImmzyMOnMIFtByXmzrRMkvTnza35coP+wvL6eocIf3sVVNuKQ/tSc0uULlkfTyk75sRqucBr7OPYzRQUuleayp5MX8iI8pbKiD9FoKJOniolPrwRerdmNiQeX184HbZHeTaqfDKAaK5ryi+FGZ4Ro6oMQ5l47BzRsdYrX+mnybPb3GcaHOm9tghJc4ROKTiXFpwjO/eIjYOXeErv5raXTtlm5XlDi3FTzJEmr90YGG5SeuS9KTepBNr5OwdVIUuh+zU++ab26IsD0J9qypaxt9AR2GAKd0MDUj/WVkCU1vURjqwwridtCI7I27h3z5BRppnENr7IBnfcz75etUII0YZD9rvbNsyXSeDVT5WxQLChUx9n6fKWKbHA== 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)(376002)(346002)(39860400002)(396003)(136003)(366004)(8936002)(956004)(6512007)(2616005)(2906002)(6666004)(36756003)(86362001)(4326008)(83380400001)(38350700002)(44832011)(478600001)(26005)(6506007)(66476007)(186003)(52116002)(5660300002)(1076003)(66556008)(6486002)(38100700002)(8676002)(66946007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fUT+CIWB3vQS1xTsDpZOs4QR8AEMxVEuO9fO9eRULWuDAKGo7V23X3yIfC/S3G+I1BL3GwtjUKjA7sAQH3kDP94WtYB/69+uJaneldKVtydnFcVnM2Ez1wRGOnVlUOBwHLVxINuPB5a07uMXdVIJ8I6SS8bEHlMItbtqT1KAxibTrNWqA+sfYhoNLDhT0vN1yq9uQtmx5lQmdJyJxSFu/PeTkzD3QJ1wEHh411idBTUFSxi0SldjSsjvPOXL87StfsPnN3UW5WtMnbKB6227wIy26BBEeXlwh5N4uYwKgSntXsb9bNBTurJ9uSEZ8bnBM6yXHsboNVQ0QmRM5CAG7h9DVoGRMZMYxs5r8ab81iwU7C3MxM3iiW1GaR0A4hCgK8MDIgiXleGK3d7KIPCmPAqnRzhbIr03s6XhLwCT5fboqc7DKhGjFkre9X0Vr/sXDtjsXu3ORFLPOO1bHD9EA/f+cZskMglOk/GNypp55FrKIlB6K88bl3/2Twd4j257TISMxtnjcB2acHNyeApg8vJryBhbKZAvt/qKVaQuGeTdzd6HLl1CvDoJQpjpza2d6wP3fNHtNPupZ5GrdyX2Bog/MdiJv40N845uj+klMqAZfAz0Zgwnhpn+q/YxMN7C7FhChPeedJoQjQB+GS/6EwTRV96YenGBed5smIDdCyAXjdZCsA96dK/pkvn7gh14OkoN/i+vGUH2x31H3xxhSVPEgUXe/2YB9ofg17XT0qXNSXQ7WevjMwmhYnjfDbF0sWsI7dnnq4nZBjOnL4b8yxlXxrNwHqMz0jzTUMBA59n3ShdKB0c/B327Aac7IawAIgPIdz0xRxHGHxwec0T7y2XbqofAxNOFIzGW+Wt+OfQVbyGQI/cw33XFGYjJPh8nwVXSGqeL6v0M7F4D3Gd01qNFdO7swpyOgPfZWh8u3Mu9QG3PuJOBDhn7QteWn9Y8+gSWhERNNnusiv1Oxh9JyJzEisUmzh7LWSexLjZOAfDTsifeuBqorwh3B4QZo6mVBdpT20uiDYEuDwtsQTKPTcQEVyIR1GA4LcWVPBGvU5tKKBxaI1IFaVLaLR3SXrHuD4FGpuHwwxSMEAIFrKaT0GnghkMlft4pnz09MTcq+DvezzkJJB/Qc0zQzpJjA0IY6p1/jcSr4Fv+V4oagohlDP8d3L40grHH+TpnPcn0eRm4QW1gr9qBBvz5XZ7+TDXFnr+OXm9yjoTc0IPydbYbvYmkSYtNTqcy7pJ6T5hb1Hr2DbGuE+BOLHyn39OUc08uoTw9q5fkDGu+VxSGkF9khDNMyhvfvSiIUPnxKOipNlLFJ4MojhgdcnY+DWjN8Z/u X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69b52c37-2635-48f5-3622-08d95d611ab9 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2021 07:16:29.3004 (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: uamBZaEPhYaC7018lTLHzN2oorop4PzZucG2uppfnoDYLJQNIMaorNuJk/6QeTTzea863NydBBKPtMp4vRhCuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8461 Subject: [dpdk-dev] [RFC 14/16] 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;