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 54F46A0C56; Wed, 8 Sep 2021 09:04:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F2D041162; Wed, 8 Sep 2021 09:04:14 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60042.outbound.protection.outlook.com [40.107.6.42]) by mails.dpdk.org (Postfix) with ESMTP id 6D7EF41158 for ; Wed, 8 Sep 2021 09:04:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fmiXy+VipZlDoEnCa/IxdJEK4nb6ZFYGavYMoH5FaPwsCrsYBSwLh6t441sL6qAEbazH8s8GoNTYSUA9bVVENYbe3jhc/OxDGzx/vZgVH2fVQGqdethtJfrUHAO6xo8NCdw2Ssk3dX4u9dEDuHbBNeHQpRZqvSePpI3aiixlOsKvl4ZPrECyxDetmbc+BMkFQM9mHm+mV+7961lTyrUYTGD9J9imvRvQ0RZ1MPLWIbw/eIg/9wJIGduibeNCfYpiI47FdtUqAQXO5KHWueReu6qRRntcx43ACFOUYEkPlLD+muX1p20M29eoWr1MQWdrSBInBdyE7tMxqVSU02wxAw== 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=ZwTvsrBUYr+Pi9UTxweWsOzOAZm886yL1mrN+koT+JA=; b=Xe6Nc0h1i38ex1Ck4jmwmJbUAu9uqb5GFgvNgrPpbojt7XcAprBBBKNdEiRqnjuZKMum8EI4NJ49P4ZLFf44FqAsgfv//M1JpBrYj7hSx7+4teGRZVEYvSHxmvdsIsEgCsLxniR/3RoP9n6EU1sIAvigetrnuAPcak6lfMXM3LtPLwRzLe5PuwjzIat2Geftm2Rr44K66Ca7UpRIc4dr+4DY36AQ+MGwkXAOVmNwO0A/5xoi0UeqQj6e7hQk2lzvmTNil/w533x2P0rwP1z1PvmZtZTiJailojQ3zWpDVyWpoc8WTvM8fBEA1Be3O8ymmhZX9+/387ZgWeU8ZGksOg== 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=ZwTvsrBUYr+Pi9UTxweWsOzOAZm886yL1mrN+koT+JA=; b=Nxs0RBvid7vLtgAblCxWtdVvJ58jiVBDYWTWisKB52YxpsI9UVjeEICC+PKV4PpgPgMURGJhhnYhQl/3625VsxX6yPHkQoGb1pmE0SSmV6MOfPVZkpyreMYdvwmIwYFNUvFVas58tQmZGpKy8Y/Ktl20dIqQWfHV0rwH4mj0cWk= 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 DU2PR04MB8903.eurprd04.prod.outlook.com (2603:10a6:10:2e2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Wed, 8 Sep 2021 07:04:11 +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; Wed, 8 Sep 2021 07:04:11 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Franck LENORMAND Date: Wed, 8 Sep 2021 12:29:50 +0530 Message-Id: <20210908065953.28349-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210908065953.28349-1-hemant.agrawal@nxp.com> References: <20210907083953.8948-1-hemant.agrawal@nxp.com> <20210908065953.28349-1-hemant.agrawal@nxp.com> Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0087.apcprd01.prod.exchangelabs.com (2603:1096:3:15::13) 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 SG2PR01CA0087.apcprd01.prod.exchangelabs.com (2603:1096:3:15::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Wed, 8 Sep 2021 07:04:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52f6fab5-ef6d-4601-0343-08d97296dc40 X-MS-TrafficTypeDiagnostic: DU2PR04MB8903: 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: 669AXLCn0p0/gatPdw+TO/LvmHDjVCd9w7pgL8Qti1EmvbSaXt49sESCsLmewGKlODmoNDT3tTlzGoHit6aPnL8T2Z+lhu2Wig5J10Q4VXxZpHoGGkbT1Wchsax7O3aJsdS1XLZsQ9uGNML6UXdU+bYHUm6ZoOw/3zmQ8JmOvPLI9DiAERBLxZEezY/MQJRuBGcZ0aWkK/tHoIhqc0w+IPbsh9WetEhThKvPgklJVq3oXJsszC6opglVjgX/cOn6Cpc8Xp51eKVCyQYnl6CbED7W9FudxYfXLZpwpW6MMkUTkzuawG6zJvPwuI9RN8aCxf9jZfSN2zHECzsI0CziIXPQB+Fhwm5Lm6PlTZZBxJYmkvRt9MJR9rBC0rBFB8oYakzZ8vSiw3s1/3uP8jI/cLs36jh/2rSh4PoqS74AWjTBZJTjzN/gdFjmR5z/5v8AKrXCUEJEdDvkgfGb6doEew5MFglKlTrL8wVpZd3IoBNioOkKXE5KhIvcZZWVacZikaZFRW1aR+SJGsbtY1O10QT33tqxk7n0UAvNDhm+f7IDV2TANjg1MRjtUIDSrTa3h+I7CP708RtTJ/YYQefklLGrGPccmLGQAARzDXa1oO1zPeOUoakNswYoXgLuKVHqpM8ZJ/e5wRZgZO3xRNgIGkDRWlLJPIQTPflsm68vTNvkVME7Uaf9mfDV1cN8k3CRa30mkP5zRZXlZ4sJr4EK+g== 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)(366004)(136003)(396003)(39860400002)(346002)(376002)(52116002)(38100700002)(956004)(478600001)(83380400001)(86362001)(5660300002)(38350700002)(6666004)(6486002)(316002)(1076003)(2906002)(4326008)(44832011)(6512007)(6506007)(2616005)(36756003)(8936002)(66946007)(66556008)(186003)(66476007)(26005)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Dq+cQpSJzweHY6jQFCkb2DhXS5SZudlA1X9Eb3sx2ZKY6mUSQS/kQwzI4FC9?= =?us-ascii?Q?OnSXmrizn6agKCoasA4tWG28Bb/nCFaeEzxwMlZHLTcdV7uhtJDQyDISlGV/?= =?us-ascii?Q?PyYoC0PeHCacxtY4CSSGFQPTwQPNzP5cmGwAW6uLWenf/wIsKK5HtuE5H10y?= =?us-ascii?Q?U6ROVGuL8L0I36ksXb7R/ULFLXxXnE4uKbPgeDcra+ee1H4aLEdr70E5DD32?= =?us-ascii?Q?mHc117OpdZcaM3QgaTMvqOrJ26/pTQ6rZxkm2v1fhxjlCDxNk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/cwiZWo98UWpdBTtfxz8DysJ4rWf1?= =?us-ascii?Q?FQLXLk2Vp7c7ibS2TE3GdWmtTBJDu9gg+uZE5AKeE6Hmi1cjLKOZSsuJhgAd?= =?us-ascii?Q?IUQ4iolWqWhcrvajSCqYYk9vWPVcCxHDHHrpruOg1B8RTU9izH2J1euCd86W?= =?us-ascii?Q?D1YjK52l6zUzWmeGosvVmAZF?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52f6fab5-ef6d-4601-0343-08d97296dc40 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 07:04:11.7550 (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: 8wujj+ESmEnQK0vy5+UWNBivLoUppIesB46kzEOllsecnmhOtPnfuJ9XGDUSRfiiS5pt8WHQOHXQQj/EjUQLlQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8903 Subject: [dpdk-dev] [PATCH v4 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(-) 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 1ccead3641..6b6fee828b 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -3261,12 +3261,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