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 9127BA0C53; Wed, 25 Aug 2021 10:23:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D5C80411DF; Wed, 25 Aug 2021 10:22:28 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60052.outbound.protection.outlook.com [40.107.6.52]) by mails.dpdk.org (Postfix) with ESMTP id C158B41201 for ; Wed, 25 Aug 2021 10:22:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MRw6VhICUMEMxWgMfYM2zTVPi8Ek7wnPCpQXWBUFj3NS6C/lchR0LA8CVR0MZr+QCF/8D73mXwUhVJBlf0C5D+612ibGYrH+VqR8guDfTk+q2KbDM6wFqjMl+ylxEUXWUBkk5R+MDXShqSvE+po9Qyhpn9/2mm15pATKTO8mHOKIv3kv0U+jfveLCfMWVQaRQ0sBejJdGpICJTeffqfIOHP6CkTwXByh0UlMrjHYtfSESGEEDVbUFzuhWr+cV3ZyJFrgA8zRF/n3uY4sfwzdnWlOYiW2k+IsfGFvK/gDwMV5eBSOnNKFVsgzwlmMGJXeWyUsMcKMB3URkgvYFkt1Ww== 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=QSQVz2kTj6bO0BAx3VsDyMOTDLe7LgQzU4fvP9hAT7k=; b=gjnrxky94znj1Cag21Juds3qBNSZsaYMzMz2WjRTSMYL5PMGJDjbOWw9+h0gxZ3j4/3fM1FVXRX3vKaatpC+Cl5XjaIoUvGN8IsbMbXE7r6bXJp3U/10yV/TexnQclQZi0U0+36D0GjPKV33YQzQ9E97JOQ1g9ZXMJEO0y/T7hgn7GTd7mVSgSPEnFoDIWdw2ccnRtOnRCU4gQYyieQ9vpPFWAOR7gtZ1D/w0xQyADwl+jv3iL6gZBdgl4dnV2ow1vYsT1JULuoTa17433DsIva8up5W/ptqY97mEIdr8pL+PtdvFgEGMt1c4xu2llLhq4KUmp9Rjes9jXffb39WNg== 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=QSQVz2kTj6bO0BAx3VsDyMOTDLe7LgQzU4fvP9hAT7k=; b=jjqWmylRYspy6o05sG8ClO873iwTrIRjNbDeLaAK4aiFCzBhMe4lwgiEiClutoJABzNHBLzvvizqtjQQ9Me5FI0CRWyZUABzTSvKeRLDeZ50vUd9pYK1k2Dt3udX/6yABuXXc2Kz38xN/RKhDc14fAsmMm73yLUJqexliQIQMHA= 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 DU2PR04MB8934.eurprd04.prod.outlook.com (2603:10a6:10:2e1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Wed, 25 Aug 2021 08:22:26 +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 08:22:26 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Franck LENORMAND Date: Wed, 25 Aug 2021 13:48:34 +0530 Message-Id: <20210825081837.23830-8-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825081837.23830-1-hemant.agrawal@nxp.com> References: <20210721073920.21893-1-hemant.agrawal@nxp.com> <20210825081837.23830-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0106.apcprd02.prod.outlook.com (2603:1096:4:92::22) 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 SG2PR02CA0106.apcprd02.prod.outlook.com (2603:1096:4:92::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Wed, 25 Aug 2021 08:22:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ece2dc1d-fc07-4cad-5ada-08d967a1788b X-MS-TrafficTypeDiagnostic: DU2PR04MB8934: 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: b2PZLnQWs0NXPfGcLVGQ/aFecMO3+TLHHQoRRSlG/Fnm7Ql9LuxfXQUoOkkFC840p1htJ3i/O3gB97RmPxDadpvUSOR3zasfb64Qe5VO5XeXfFaSISjyBmCTIlZk/YnfPnSAdq8y1S23OQVLM7PTy5BDyoM2yFoSSJvEgfaQUnfpwElex8GtYofHlErSwzwZELeXRuFmTNadWubRxkS+/sT2F8Z4v4slEiW4oWwn5AYRz9ckCeglRvzQ9xmtgs9FC1IIH5Npxrsbog3UBO9YTDXUI0qwP9CYwMClGK/pf/I5bMyflTWag0H6gmptAumFIz19KX7wQVWEt8wItNKnJvgL0yr/A3jQ4m2M02vuS7x5kXQEVWdTt0LhQwkjMa/xIY4ymTx5A1IMEfDogxwaL2EorJ4hbR/x62VTnl3cs/fe3SyIkUpiQo2PlFrEoUm6qEIpItLD5+ITuC1qhRkmwZeIyKcxxnauJI2S4WcUvzNtBN7kiwpY7qC3tfe0Dq5a5ZZlbFkPHFwNb4E1dPpQ6gFiuDzhTaUtu7N+suJ8kT4mI9CEekGHUCr07tmj3tmZ21mO9hxqK5ekLDj0KQVJobp9VCR7dZZ08r2mDgfCmDzVzPsJb/x/gNtLFiybD0i4RzlJVNw5zgVt/a2kosz67YAIF3DMfFerGR7KWY9dku0qabbO1LzKWYMVGnJ/xBm+/l4UOqiifNyip6nrSCKcQA== 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)(366004)(396003)(376002)(39860400002)(136003)(6486002)(44832011)(6666004)(316002)(26005)(4326008)(5660300002)(6512007)(2906002)(186003)(8936002)(36756003)(38350700002)(38100700002)(478600001)(52116002)(2616005)(956004)(66476007)(66556008)(86362001)(8676002)(1076003)(66946007)(6506007)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6/JeHHppnvEqIDcqTYjxyLshiiJXbfOWgiLDXAntgIKT6ftLQgQG4oLP0Xkp?= =?us-ascii?Q?afvBoIOAfYGIBpd1SKoA5VgyNzr9fBakosX8DFclHGJZdg5eZiT/RDJehzvn?= =?us-ascii?Q?0VozIa+KK9WJgiisPhZ8JA6iJqCnlRhqWfr06obxQ2vR2Cc4uF6e5w9Ishc9?= =?us-ascii?Q?sYvX5gscz/EOpxhoBTY9AbeIoSP69eWxm3iLDA/AK3wz+KezimP9NfF08Qa4?= =?us-ascii?Q?l3AV9PVRPmAhsCQimqvYizVxPmD02zMtmlR8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ii?Q?HyLxgwW0x9Qfd4gWIVRfvzDV8kZuTyMdzTqkB9h0NbMU6asHHCQ+1wiQhNKT?= =?us-ascii?Q?hdDLU2XhFnNnS8/1Qj82Y4J66nhyhCGPThVtwruB6toqkyTbuc4WDBMOZqSN?= =?us-ascii?Q?RmzNzcOUaNjDZhbeegZfLxo4NOlw2SUsOZaQuB5pVPlJx4TPHGQChSqrNloF?= =?us-ascii?Q?6pw+6owH3NeQqrrmVkqugeA7?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ece2dc1d-fc07-4cad-5ada-08d967a1788b X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 08:22:26.1431 (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: jf+46F+o2OCHWV5Yw4po/NiZ8QFEyws/+Ik7J/kUpk84AfLoXOcEwwYHYAp0NmUkXrEOiboXnguzdstoq6k7SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8934 Subject: [dpdk-dev] [PATCH v2 08/11] 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(-) 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 87a94b2c04..3362e176a9 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -3255,12 +3255,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) { -- 2.17.1