From patchwork Tue Jun 20 14:11:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suanming Mou X-Patchwork-Id: 128858 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D710D42D09; Tue, 20 Jun 2023 16:11:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C57A742D2F; Tue, 20 Jun 2023 16:11:51 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2065.outbound.protection.outlook.com [40.107.244.65]) by mails.dpdk.org (Postfix) with ESMTP id 6720D42D29 for ; Tue, 20 Jun 2023 16:11:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FxwH7A75nxuXg+x+B/mVHz3rM9hHcV/cVLZNcHLjIIUVxja9Qn4GXDch6/e0XVBopuaD/qofM0YAr6bFzbhnxuzUWcWNbD1aUiM8HqVkvYTQ0UyNdTfbTK33zKWZcDI0EhVEkPjQI3bsUspLFKLTuimkFP2xDSZtZCmon7RuhVuaEpSIXjqcanveNWsG4rzoeu3E8Xnn0YwxGZg+fDlVnDbMU0C2v6VQEX1hMXlmpJVo8SvoIBPdZun2snUy4rHJbGGo+rvilqMDnocXlsJ1xfl1vm6ZyaV8qvCpVRuWQn41YtBDEZMGU8ZHmseWzIp8kzagTc10caTs+Tox/e0wTg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=09QGfKiMMv1V/kZso6hbwKRBW6bPY/tfncsO+yQTuO4=; b=ebW889NtxHhk1+OKorO3MSn3ZOCdFJo3EWtbfO9xj83q1j9m1OaF1TtKrS5K/oXCzCAtc0OjDtm9+3TWI/pA2mhxaVFZj8cn9bN2mZmNdyn2tLA5SWjh7asTEXsSW9PIg1ripAyO+57diraTPvMaQAkciR0taE0j6DtSLUMBZQhey76KGXt1Ar8LH+8SXZfHQ9duH2CQy4SNc769XcifSxaqBWg1MDO+q1EUaHHmHWLB9kGWbQGFb30qTQDMDuizThwl6vDR9PGun0gldra5VQcxRfwj9QWCEszubQbaoXVxZ10pSN+6wXikudAE0D3fUK/zWa0ZSyTp+l8fu6etOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=marvell.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=09QGfKiMMv1V/kZso6hbwKRBW6bPY/tfncsO+yQTuO4=; b=NBPKZBynEdH/oYhDhgBKxUVarb7jz+Z1f7LbO8JUDikm1mlI0WEBlpnNJPiYDPTO1S5r5jwrz83MjS+zecy5i0VWQrTWmj/LvLFRA2sD7enXa8qxrofgucivwLzilwB7D98mU/OgV2+KvpAVM5Z7FLBXwFx7L7vplv9Nh1udijexgBpqQM5YwdQCOtJ0uzVs6MWL/LosIbGTxL99qsYUcKVsZmPFKESBQn0l5Aipe/mjtbIoBrwirg/69lLzKBKJyhbl0Pf/k2Uh6b7ON/Q0pC7G1oArn2UFQ3I3bHJIOKKtPr55Yo9URLCGompUOKhRYQhCyT/JvaVQngPZMqv9gw== Received: from SJ0PR13CA0162.namprd13.prod.outlook.com (2603:10b6:a03:2c7::17) by SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 14:11:48 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c7:cafe::c3) by SJ0PR13CA0162.outlook.office365.com (2603:10b6:a03:2c7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21 via Frontend Transport; Tue, 20 Jun 2023 14:11:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.38 via Frontend Transport; Tue, 20 Jun 2023 14:11:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 20 Jun 2023 07:11:30 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 20 Jun 2023 07:11:28 -0700 From: Suanming Mou To: CC: , Subject: [PATCH v4 0/9] crypto/mlx5: support AES-GCM Date: Tue, 20 Jun 2023 17:11:06 +0300 Message-ID: <20230620141115.841226-1-suanmingm@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230418092325.2578712-1-suanmingm@nvidia.com> References: <20230418092325.2578712-1-suanmingm@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT037:EE_|SJ2PR12MB8830:EE_ X-MS-Office365-Filtering-Correlation-Id: ad04ad46-b800-4a51-4b21-08db71984902 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FbfHg/iJIOUaGAOwkyMROp7qU/aZ9YLTntsKHGBvJdFyu1sHQ6sTeC5rExXz4jISUfBvMj0A68xmWmTLq8OUSpHqhHODkFg1eS0BznjRgcBsuazeYUli08z4OgJXKuU7FivE1BgGQuGPBXG0FsPhpoHkHRS2XXSMI6CG2EuG6P6RH620rkBaMqmQJL2L5QEK7iw3q1Y2l2SIbqkJxrfNUL1GbEfezppG2WK22P9nNBHgILrK6hX7uo/MYABtbRqQ6SMP5oXxuoh3v6ph5LDqsHrA44BnI0ZU3bWfklCWAjN/x+EUmqbdWs098sacVJd6VPNEZZxMPn8WIu532A0xymZrxmdXUgbyLDC53cSe/Na7gAUAvZfM+xPHBmC3WC9uokuDj3vBoH5CXBVn551ZgCGi8ZTwrxtx20NL+H8+KZXCOeoOGRykKnV50VTpiyLm4HF838G0hF6/8CSOeHB/uwh27dzJ9A+RzK6HqPcYSBWhjt54KvpFovKz6O3T1aLUzXdPXHveWsEIvU7g2+FuwS0S1KchB3lG/byDQaOl7PvvI4daQOlglxP5WBQgphBdIv1ODLqEiC9ELr858C3P3dlgEyyYoZCtguCznxngIIfFes3zkFAk47bCCTXKWUSr6L7NexkTeR6IwTDZ/rwVKFvXBNzWEtO2yti0B438nDHVIoJF8RkXjVkD1Pj+78FKz9bSMRBZYOR/avMQmVAA9nM0TB0+cuJ7rzGmFEYMKwkXhaDvQIw/Fo6tuHySz/GT X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199021)(46966006)(36840700001)(40470700004)(2906002)(41300700001)(40460700003)(5660300002)(8936002)(8676002)(82310400005)(36756003)(55016003)(40480700001)(86362001)(478600001)(26005)(1076003)(54906003)(186003)(16526019)(6286002)(7696005)(6666004)(70586007)(70206006)(36860700001)(47076005)(7636003)(4326008)(356005)(6916009)(316002)(426003)(2616005)(336012)(82740400003)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 14:11:47.5505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad04ad46-b800-4a51-4b21-08db71984902 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8830 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 AES-GCM provides both authenticated encryption and the ability to check the integrity and authentication of additional authenticated data (AAD) that is sent in the clear. The crypto operations are performed with crypto WQE. If the input buffers(AAD, mbuf, digest) are not contiguous and there is no enough headroom or tailroom for AAD or digest, as the requirement from FW, an UMR WQE is needed to generate contiguous address space for crypto WQE. The UMR WQE and crypto WQE are handled in two different QPs. The QP for UMR operation contains two types of WQE, UMR and SEND_EN WQE. The WQEs are built dynamically according to the crypto operation buffer address. Crypto operation with non-contiguous buffers will have its own UMR WQE, while the operation with contiguous buffers doesn't need the UMR WQE. Once the all the operations WQE in the enqueue burst built finishes, if any UMR WQEs are built, additional SEND_EN WQE will be as the final WQE of the burst in the UMR QP. The purpose of that SEND_EN WQE is to trigger the crypto QP processing with the UMR ready input memory address space buffers. The QP for crypto operations contains only the crypto WQE and the QP WQEs are built as fixed in QP setup. The QP processing is triggered by doorbell ring or the SEND_EN WQE from UMR QP. v2: - split XTS and GCM code to different file. - add headroom and tailroom optimize. v3: - fix AES-GCM 128b key creation. v4: - add missing feature cap in mlx5.ini Suanming Mou (9): common/mlx5: export memory region lookup by address crypto/mlx5: split AES-XTS crypto/mlx5: add AES-GCM query and initialization crypto/mlx5: add AES-GCM encryption key crypto/mlx5: add AES-GCM session configure common/mlx5: add WQE-based QP synchronous basics crypto/mlx5: add queue pair setup for GCM crypto/mlx5: add enqueue and dequeue operations crypto/mlx5: enable AES-GCM capability doc/guides/cryptodevs/features/mlx5.ini | 2 + doc/guides/cryptodevs/mlx5.rst | 48 +- doc/guides/rel_notes/release_23_07.rst | 1 + drivers/common/mlx5/mlx5_common_mr.c | 2 +- drivers/common/mlx5/mlx5_common_mr.h | 5 + drivers/common/mlx5/mlx5_devx_cmds.c | 21 + drivers/common/mlx5/mlx5_devx_cmds.h | 16 + drivers/common/mlx5/mlx5_prm.h | 65 +- drivers/common/mlx5/version.map | 3 + drivers/crypto/mlx5/meson.build | 2 + drivers/crypto/mlx5/mlx5_crypto.c | 673 ++-------------- drivers/crypto/mlx5/mlx5_crypto.h | 101 ++- drivers/crypto/mlx5/mlx5_crypto_dek.c | 102 ++- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 997 ++++++++++++++++++++++++ drivers/crypto/mlx5/mlx5_crypto_xts.c | 645 +++++++++++++++ 15 files changed, 2018 insertions(+), 665 deletions(-) create mode 100644 drivers/crypto/mlx5/mlx5_crypto_gcm.c create mode 100644 drivers/crypto/mlx5/mlx5_crypto_xts.c