From patchwork Wed Aug 25 07:15:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502244 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp346095jab; Wed, 25 Aug 2021 00:20:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW5t41K6HlCMiCbX1idrH4WMdnNl+QPr/maqwVgtH6D/zX3zC8zDiXJIfRVewuZ4vMVE+C X-Received: by 2002:a05:6402:520f:: with SMTP id s15mr41140228edd.139.1629876014374; Wed, 25 Aug 2021 00:20:14 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id p26si21656860edu.78.2021.08.25.00.20.14; Wed, 25 Aug 2021 00:20:14 -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=kY62+08q; 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 E3E86411E0; Wed, 25 Aug 2021 09:19:19 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00072.outbound.protection.outlook.com [40.107.0.72]) by mails.dpdk.org (Postfix) with ESMTP id F416740140 for ; Wed, 25 Aug 2021 09:19:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RgRXymcS+B5C5DfqQGoiXX+bih50o5+HkuTzId28NBv0GS41cOr3RylCRJbiWFm9w9jBIZ8ufgzvApsPdQf0bjFpQnLQUcnfyHMAnIFU9KTljj+n+6vfUNjFYhQghmB2NFrRaXgP7AD67FSZKjvOgnVn3J9Ld5MGIem3s34r72617quvxp3T05j/rzn+nhWLeFkBOijiCXzOzm42Oe43EbNiCcwITYkVzzkXpVf4O62/Wn2l2fDe2gSJ/DUGqSoBIquhWyFVhSRaQZv5c/HrimtCFkT9rVn5ZfxQKaGaLJfjCvVzyVjvyzY4FT+2wjFjrYEnsPYYTf0hHKFi2lDoUA== 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=GR5Nvn5+p3rppCv0ov0xhlZwrIlL1dkDuX9szJgKMROcTgUzlmwbFXXqo5M+325m7B6Uw6U8KvYq+lKXTHjeFcP7tp9HokdOg2hELKYxbYoIFK7MHvWczO9WcN5mZyvAz1bFC81uqDzX371yZKEAJzYSt1kRgXxThlaAVb9sefxwomyBpePS4Y8oAUSLhNYw5p78GDZn3ZRcsiyFwFhyyodg59j8lM9JsWrb3j6Fn71Ack+ZENWvD4u7pT8itc0E9PNYHE+GBar3xiaQNY/yu8/PHuFfNrXxYARqisn83k2Bdm93yQtYfQcOvl787wmMfHo31Zy+wCm4seSjOvvhnA== 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=kY62+08qDt/YaZq3KS+h0YYK9maAvkdsNTkhs5LMmBGclcWMv3qRu/qoKA+3jBDyE9+itARZr9E0yoLGShx4xia/Hd7RWvFG3sPh2T4IUjEZa4P5Et55VGrlWp9oz4aAAUrAYEFcyDj34GnbSfJwPcgbC6jZqoJ7QDWUcoYzsNs= 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 DU2PR04MB8872.eurprd04.prod.outlook.com (2603:10a6:10:2e3::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:15 +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:15 +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:08 +0530 Message-Id: <20210825071510.7913-14-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> 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:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 197ebe44-e411-440f-68f6-08d96798a4da X-MS-TrafficTypeDiagnostic: DU2PR04MB8872: 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: tyN+qzGf3/IyuApv1u6y6N9udSe1cTNZ7OSgrAj7FRmyxmnDWbeirenRcBIt7QxFRbbrFmr+5BjL0k1sduCzNprTexjKOwOQ42e+OZd9VH4CbmDIuydfW/gzlI6h2o05FK00eR3fTMwZGHrCD/mu0KpZ5wzvgneflddgEki9JglRa8cB/2eoDfIttST/2UnMd9SFSdqGM8uGjGgAFAJfxP504qLpCk7FRWx9nSOJExveQ3r5YaPctEyKsObsF1olFXmOTKfHiJ64w3nPtuwCNFtS7oV9ekYbmeiPXhFBZsX5OUIp83T3m1B6ialEOclQ1riAJu4pCEYeSe4Vmg5IZnolmdjSMQANODPDSTalyMbHj9b5Nv7s6NDXSbs5lugErEXPuqUjwLUyFUOQQI1Ygp1NF7t2a0/Rpyy2Ifvu6cHhHI9TMCdaORUcqJZgAw/sICbBOpmLkg/jmNSjbuacfbXLUyGq2VTrBFShXFCqlkHrxULfrikZ82Sw5lxnV2M2KwqTkNcepdPCiHV7A7Vp3pGp2WmSTVGiS/XzSMSjv2Kf+PxkHrpw+F2IznajQeYrRafnVVu5mwExUqXDGQMgz7OYQWtg8BkKN4QlTzLtLavO/eARShOYEWKbPsKLNtSsf/Dr/pfYMZZGL/GGLI3gWcVuqDr/IMqg9LxUHxTY6uvEFgTBnx3TjRcaLDDlXsz5Fa9IuqZcwFmYqAwLmaHDFA== 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)(346002)(136003)(366004)(39860400002)(376002)(396003)(26005)(1076003)(478600001)(8936002)(38350700002)(38100700002)(5660300002)(316002)(8676002)(6666004)(2906002)(6486002)(956004)(83380400001)(186003)(52116002)(2616005)(86362001)(6512007)(4326008)(36756003)(6506007)(66946007)(44832011)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 33DbmDdtzt+CDPx2ki9I7vfKgD4HowCSRQPKTTEnQI5oOIxSUxXOJvvKTtxRHwkWNGWyCqGSi5eOkQRr4pPJmbYu82k/bq5ndFd0GNFBTlUFVzqK04UQkkfpMECwl2pMVtYlTL0U7C+XPwS8cVa9KXk0XlU4KYeVwy6xEYxl208NXB+O2dFAq/KhPTjPIFx96f6l/qjZTL5bREm6bBoO9f4qHRwRDwJ6KIERKhMdCO8LmeLLZAYzcIjh1+xjRm+WLIDdBg7wm9PGUTPCMTqNFCBtNJDj+DXHkJWcaHePV3fZaWajpJntpgJe49dVi1kIdKNFNLzJ+tgtG8g/rFkMtYrk3r8s2ct25Z79WcVLToXc2uiEi9C8eax9f1qToH99HaGU1yMfrJ+TDj8Ueyy31iBX2FEY3QSWMAXmJrUqahxmocmphwIJxX+xpy2OI0d8e85MdBV2BCh/eB4SaykWMwAW9rTl/qZF5oiiLD7kSdL8bukHYVNwynZw3v+6MKlJTtgDDW42uH2xmKq4nY/LciPbL+62bYBT6Om92Np5P4Zr2V/JLV6KN0h5zx6KU9ibm0a4rywMQWKt31PdjfoZcDpnXISkp9b5jVUzSiENzDJbYebrNtL19Fu2q5xbhwovDBb4nXOm+EC8mU4K6e8HHQncdL213DsBjkj1kKgr30+HQe2SqvI5GlK0zj60FKn0mFax5id2S79dM91uiQEZ3cj98Rf6ck3D55iaKVyUb5y7fmkWukLZUcKIkAuBp0M0nqJNi97vQmkwq4D+16y0kApisOIieyn0v2wdJs6CaygWwTCbPau/5CDEVMoTFRGQU5oAvgXoErAjILx0BMmE/E/tWmR1v6JRaQxFDqZ/ErxFS9N8zobQD/1GVCuiOBbe4rEzFzllYaFVTm3QKX7mGxDsphCD8bIq6QvCxws/VCR8ng2pEWyV4WIyLAs4v96XmReOyHMeDEHq+BcdwZzLPJ2IzoRRKTSKo8AonyVaGJH4TH2n+j0irlri9QKCN4B/gv+l6egWHLLEwnofJ+ivDq6Li8dvOLdlRuCiPbkQM7sd7SftPiC+dj+qgvxZUgoo0h8HDMWzzZtTTkcmTpZlc4zjcVCuQxE4p1nxNfbjBrUXxTE3M/pBV1RS1tTPqOFiMoFVrbY85PyvUFwyiq60d2MGLt6cFrcMadZzF4PvU/57IuoTYJsb3dVTJ5sr7XG/VHXAqZ1QzYLMVtHiZ8nEQOUuNnzix5979mrRC87vnFOjDNunTUgMbsQ+eqjVd/LUog9cYHv4QI6QZiBkzP71UWDoL6H6eQn1flrZTPqGsgpQNN7xcFpU4WyxNf2mtIku X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 197ebe44-e411-440f-68f6-08d96798a4da 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:15.0059 (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: FwkA5kr10I+CD0nXP9BxgRN6s9L7DQSMCI7WrP9SZBJ8OZMMkXEEg+3ZbM97HPui4kd8KNB0QL30KV6m4ykNIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8872 Subject: [dpdk-dev] [PATCH 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;