From patchwork Tue Sep 7 08:39:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 507524 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp4033235jai; Tue, 7 Sep 2021 01:45:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycM2dCgZDMWDVDyJoa6xVzXC55KGpPCqYm8JTg79j0coBvRTQFXusF1F1noxMxPuEHkdHK X-Received: by 2002:aa7:dd93:: with SMTP id g19mr17445673edv.262.1631004310345; Tue, 07 Sep 2021 01:45:10 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id i25si9697360eds.119.2021.09.07.01.45.10; Tue, 07 Sep 2021 01:45:10 -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=q+eAYeVP; 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 1E6D941150; Tue, 7 Sep 2021 10:44:46 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70089.outbound.protection.outlook.com [40.107.7.89]) by mails.dpdk.org (Postfix) with ESMTP id 0A1DC41150 for ; Tue, 7 Sep 2021 10:44:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b4A9lNIds7hsS7HO7K1AVmQ4quSA7OdTERFW97TbNyMM8sL7hWFoTfF47PBy3IX3IQLt1tgUmdo+aaL0aH9vbG62YJ+iMFPT15w0t2xq2V0pInakKfdXN3WFoR3pgTrzN8OrWgIDbi5FHYQEyLTWyemE14/ipHcEBeuHjM4hfUjlHU1Bw6krz+6xsx1IFSgp3rX3PxIJBh4Q0gXU8v8PzbBCMdYnXm4h+WukyuXkq30BSKJw+/JurAa0zkU58H0oqfRW4Ba9YcAt4UtALnGt4fF1xEdH4Zdz8aOB4Qjv4We8ytyFpMxwyNUD+aGT6434tRNoKSeoeGmKOP/RJkbAdQ== 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=Yl1I/8ZX3chRpyMeMXT10jeAlhOt6BgA+SkvQ5QWsXA=; b=gLptQ9p+x+nVmdw1R9p0qkqGatwi8FvXobfDcDrYHbcZGnP6cMJpWk7OHqjBoMxl+n2vkm2Q2x9WQLz8dQVgXAKRIN9kCH+o5Zc1/FqeruUrcVzyEabf/O5AaA3X7EdFU6PWirGTak24T0bO+DWXh1ac0uqgV6JGS7pS5YeGWno3Uw1HcqdfkmodIJPHinnw1PRn43w4dTsRHKp3wceZNCkGYl1b6HyfpKPA/PKUBVGOsB3oIQsRfAsm6caE7tycctekHBKPmVnHdaziDy9kmCfksIpFFe06vSxZDV7bYZkmOyKKaMkEfBUbTLor/l5WkpTp4EQEqSbugZx3/roPMA== 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=Yl1I/8ZX3chRpyMeMXT10jeAlhOt6BgA+SkvQ5QWsXA=; b=q+eAYeVPMkfjpORORri/0VuAuTXThjIv76KlZAXHq+4fz+KwGe6iNgM4LBG5/NN4+ZfJVB541UUowcYOUCbFIt9N+1yUy87SnaLIpLWzCUIYJX6oUAm0jXlewiYhtia8zl0VcBGYXOrAaoMHA5j0eg4SaIo5cL5O5gIsGxsHKHQ= 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 DU2PR04MB8949.eurprd04.prod.outlook.com (2603:10a6:10:2e0::13) 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:44:43 +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:44:43 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Franck LENORMAND Date: Tue, 7 Sep 2021 14:09:50 +0530 Message-Id: <20210907083953.8948-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210907083953.8948-1-hemant.agrawal@nxp.com> References: <20210825081837.23830-1-hemant.agrawal@nxp.com> <20210907083953.8948-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SGBP274CA0024.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::36) 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 SGBP274CA0024.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20 via Frontend Transport; Tue, 7 Sep 2021 08:44:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d604fae-4594-4462-4dc0-08d971dbbcb8 X-MS-TrafficTypeDiagnostic: DU2PR04MB8949: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XuecXE1xjAvWfOAF3Hm5dnb4WrC3uY41tJd0MAEl72tgIaUnTsY+Z9cxGXFiLYvvyDR3yCsXRPMb4jh4WSRo6ziaw4iapHsgyYlHdAnh9762MCeZe5pYawmLFlIC/9JZ/m1EhVBtPs3RymGWNIlpL9c/5zuX9+m3wSRGFZi1Vouym4PEon7oym7JjWI/VVorXvKSlwEuqDegK5xb+6iE9kKjVdho4HzlEZL5LpZmq5H8/k1ht8aXUs3TaJwujijzed3ONeXZN3nItYEeaNDF85wdUUnyM3eiUC3jpMqXFco5TrPtS518B0Pjl++tlYCrHblZC4tKa4YtwWTgvgqu0rPz3Tnu3BzRSRQpkp5bFY+gAF5HgCpbUUo1ECeTheyo6/WgOGDs8hPOBQ7us6nF/mtU9bum4ifKr2heO57pUS+bfEYRarb2IiHwlEtVsI3WE/cdei2Fzvn6ntr2Zg0cMM5KE+47VVU4x0aVfB4HOknn9I61pXuH6Dkj0AQjde27A+Yp6SO81X44eyTAIAtRdPMV7zgwt3St5waNTDPnAEJOkUWfhZWfeWpBetVXTfuXUR7H2rO29YQD1QE82qCVSH8b8LVhcno3AWGufxjzb4OHN6a9PGFp9iX3IAuMf3NridgVRWiTcl+Mqch3u6srKsphC1EzmQGDdKsoOpEjO0+oCD9gIWQwaFn2tHlp+12KFDEBOenUpZMJbGqYi+QEeA== 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)(366004)(136003)(376002)(346002)(39860400002)(86362001)(36756003)(38100700002)(38350700002)(316002)(44832011)(52116002)(6506007)(6512007)(186003)(2906002)(956004)(6666004)(5660300002)(8936002)(8676002)(6486002)(2616005)(26005)(1076003)(83380400001)(4326008)(66946007)(478600001)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rtx28NNxFBTfhDa0FIdL6+xAzphys0MZ2DoG4Hw86CXey2I0OPteLbhjN7aKPAmfOaXUXH6auM99F1Yk5BHBPYqt99mne2zUK1lFYZCgN1euMJ2aNIt0e9RrQn4HltX7yg9wvQPzCZ95tVrh0E4uEWJ3bY4/HHwtHgfbmKmoJINsOkp1Xk9HyM75JsmJkZrsf809J13uG99/yjFygwtSGSWf6fOde0HAI1/D9WWm5Gjg0RvTmdq9vmFtByp8NPnhkTQMOS+tXheBAKfTEnnE9ZfLaniZHPZVhGldUQ68r5kGoiwH8y/5EMI2JDX5JD7UGKQhRL0AAFyKx4mAlpQujqaiEo2ff8tVjVSVYK73j4qXTsZhjIw0iJ/lla/YQEtQNcsfqnHJqVDfNFVZnIaGZ2dhT+qn0y3+bxMAelTE/8StUX5PNfIP6xink7FWQf4IMQt8uPb1w8/wGuymkkqv7Ox+a/pnwrkD6BCC5lbvnCWQsj4d3l3kX4oh4biC2Le50214oqaPjHW1nb7Z3eIe4SQTRmyDBOC+gCpT9llghX56N14CYIMYm1iJND7rZFGEXAf8ntI9tsddOM+ZoVHs0rdz1qoREQrJ67ffXj5zpLM5PVLE4uejsonKL4CoRE/GV6fypdsPh5ADxEJDSkdXry4ONbRjuMERKpCA4Qoyc3dYFEwWEliMe73MFCk4UxzcZ+bwteqPPzBRdUEMxS8gPY6htAZBLNeJjK/nlPLPuFZKtBhL8MYxlrlDIJCP82d8cz+8J9PQyZQP+MT36DFlHQsOvOLoLf0bpbfAxMtES5ud13iNdO0eVLDNbbb6PItiVvvLwY9af5YF5RshpljsPfrjVB3hQheZoJaMedbY5U5t8ST1pjQR1GsyJNDaaATlRdtW1fPHULQZ6GZRvT5jVgrakoG3MO0kCk+gvln1uVWQVuFBQDG5bapXCjA4M0CJ3EdqsM7f6fWQQP981ltiiR+6qxd7mjw5Hypwfv6wXkChACJldVRRyc6c4x0EFGwNoGmcKt/1Dt6tHY1T7+U5aZ2ktoLss3LPe79b+PRfi/8MCS7LwmnwXVtEa2eSrc9fMLsYmhlyLk3xr0CnJYwBUEyaFQeYXpGl17bw58rmkNgD+REU3OanxSUWxpTuYKA+5sahmumpWDgUH+vFFg/on81L+kosIWmFhAT8xHFRJ4fdZ0aNAzC/g9V1fXjO4KEZdzOMvIMKjDeC96POm+35h8XY449e0goYUB8Js0uZxLAiAa2v6l3sMqmuEv/kdDQRhnYon57dk/1bmT7DJ4gI56bQjw0FBrYNdNKmsdl73kDl8nQmn4Ig6xjTxnsRGrc6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d604fae-4594-4462-4dc0-08d971dbbcb8 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:44:42.9310 (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: KmiGK3owuX3OdApn89W9gFQlRykw0vYoXlgOvPeckAq9DslH56D7iG/Jud89aAe5JVIWW/ZG/NljrYgOJHfKvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8949 Subject: [dpdk-dev] [PATCH v3 07/10] common/dpaax: enhance caamflib with inline keys 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: Franck LENORMAND The space in descriptor buffer is scarce as it is limited to 64 words for platforms except ERA10 (which has 128). As the descriptors are processed with QI, it adds some words to the descriptor which is passed. Some descriptors used for SDAP were using too much words reaching the limit. This patch reduces the number of words used by removing the inlining of some keys (done for performance) in order to have working descriptors. Signed-off-by: Franck LENORMAND --- drivers/common/dpaax/caamflib/desc/sdap.h | 61 ++++++++++++++++++++- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 28 ++++++++-- 2 files changed, 81 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/common/dpaax/caamflib/desc/sdap.h b/drivers/common/dpaax/caamflib/desc/sdap.h index d5d5850b4f..b2497a5424 100644 --- a/drivers/common/dpaax/caamflib/desc/sdap.h +++ b/drivers/common/dpaax/caamflib/desc/sdap.h @@ -20,6 +20,63 @@ #define SDAP_BITS_SIZE (SDAP_BYTE_SIZE * 8) #endif +/** + * rta_inline_pdcp_query() - Provide indications if a key can be passed as + * immediate data or shall be referenced in a + * shared descriptor. + * Return: 0 if data can be inlined or 1 if referenced. + */ +static inline int +rta_inline_pdcp_sdap_query(enum auth_type_pdcp auth_alg, + enum cipher_type_pdcp cipher_alg, + enum pdcp_sn_size sn_size, + int8_t hfn_ovd) +{ + int nb_key_to_inline = 0; + + if ((cipher_alg != PDCP_CIPHER_TYPE_NULL) && + (auth_alg != PDCP_AUTH_TYPE_NULL)) + return 2; + else + return 0; + + /** + * Shared Descriptors for some of the cases does not fit in the + * MAX_DESC_SIZE of the descriptor + * The cases which exceed are for RTA_SEC_ERA=8 and HFN override + * enabled and 12/18 bit uplane and either of following Algo combo. + * - AES-SNOW + * - AES-ZUC + * - SNOW-SNOW + * - SNOW-ZUC + * - ZUC-SNOW + * - ZUC-SNOW + * + * We cannot make inline for all cases, as this will impact performance + * due to extra memory accesses for the keys. + */ + + /* Inline only the cipher key */ + if ((rta_sec_era == RTA_SEC_ERA_8) && hfn_ovd && + ((sn_size == PDCP_SN_SIZE_12) || + (sn_size == PDCP_SN_SIZE_18)) && + (cipher_alg != PDCP_CIPHER_TYPE_NULL) && + ((auth_alg == PDCP_AUTH_TYPE_SNOW) || + (auth_alg == PDCP_AUTH_TYPE_ZUC))) { + + nb_key_to_inline++; + + /* Sub case where inlining another key is required */ + if ((cipher_alg == PDCP_CIPHER_TYPE_AES) && + (auth_alg == PDCP_AUTH_TYPE_SNOW)) + nb_key_to_inline++; + } + + /* Inline both keys */ + + return nb_key_to_inline; +} + static inline void key_loading_opti(struct program *p, struct alginfo *cipherdata, struct alginfo *authdata) @@ -788,8 +845,8 @@ pdcp_sdap_insert_cplane_null_op(struct program *p, unsigned char era_2_sw_hfn_ovrd, enum pdb_type_e pdb_type __maybe_unused) { - return pdcp_insert_cplane_int_only_op(p, swap, cipherdata, authdata, - dir, sn_size, era_2_sw_hfn_ovrd); + return pdcp_insert_cplane_null_op(p, swap, cipherdata, authdata, dir, + sn_size, era_2_sw_hfn_ovrd); } static inline int diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index fe90d9d2d8..cca1963da9 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -3254,12 +3254,28 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, goto out; } - if (rta_inline_pdcp_query(authdata.algtype, - cipherdata.algtype, - session->pdcp.sn_size, - session->pdcp.hfn_ovd)) { - cipherdata.key = DPAA2_VADDR_TO_IOVA(cipherdata.key); - cipherdata.key_type = RTA_DATA_PTR; + if (pdcp_xform->sdap_enabled) { + int nb_keys_to_inline = + rta_inline_pdcp_sdap_query(authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd); + if (nb_keys_to_inline >= 1) { + cipherdata.key = DPAA2_VADDR_TO_IOVA(cipherdata.key); + cipherdata.key_type = RTA_DATA_PTR; + } + if (nb_keys_to_inline >= 2) { + authdata.key = DPAA2_VADDR_TO_IOVA(authdata.key); + authdata.key_type = RTA_DATA_PTR; + } + } else { + if (rta_inline_pdcp_query(authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd)) { + cipherdata.key = DPAA2_VADDR_TO_IOVA(cipherdata.key); + cipherdata.key_type = RTA_DATA_PTR; + } } if (pdcp_xform->domain == RTE_SECURITY_PDCP_MODE_CONTROL) {