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 03E21A0A02; Tue, 4 May 2021 23:10:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3E2741145; Tue, 4 May 2021 23:09:45 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2055.outbound.protection.outlook.com [40.107.236.55]) by mails.dpdk.org (Postfix) with ESMTP id A42E541131 for ; Tue, 4 May 2021 23:09:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OvEUGViDPFZMIe8gBv6LWu9TEo6NM+vovDbLFPiUsPgW3a2UwOno7kurI+2mMwsjo37vMIrXotpoTFuFxucOGea9RKp2WchrIWlhaALrCENmtlF+JB3CcKd5U7RZths4upzMuhDLRTXeEduMTQLLyR5xBMXbH0ytlSTnUx0kHDbjaSBzvBM1JkwiJNNnIypJkP8rcKx54oChvqecgqJ6bZf4c7A/UsUagNr9+Z4MwwjwONwwnEAWPKzJOqSKVtT8NeJeAftZQC6YRauYXG7+ihM14OKjKmVitnakRyF79JrU+/e7h/EA3dg0Tbg/PhsBVikR7TEyYSv1vlbexcAJMg== 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=BuZRsfhvgIrbze6TRB0x2KcFdEw3A8pnAhJex5RjOdw=; b=lrYjUSqmB/RAo/DtiDjhjck7YszVehkguNpnGl7N+W5POebexGxWNmaiNjDviUr52gYyM6rDN6y9Fgk6ho1Ft/+U/EprP93NuBfeFbz+rekDtYnM5LQXgmn2VMw/iTIPyyYV2uBkAaWVKa5XFpGUq7ekBg9RMEP6OfLchF0CuLPaXvpgpiYPkfOvzqjkQzrR1CpTxbGeCpa9QbSQjCIQFvTbuRsSXsNcQlTmHWMaRioMjMiTAAOCEnq8NICGD+7yZQUVmKrhEyA4FbzpMqBwfd0+mpoDJGrd4khgawnrwebkiFbf4jUj6jiCH5pOyXgP06HIM6KY3sxjraEboS5akA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none 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=BuZRsfhvgIrbze6TRB0x2KcFdEw3A8pnAhJex5RjOdw=; b=H2wAgZuZ41IND8/OobMjlvl0c+7zmG/15nWEB7ZgeqyZBVUzHV5tO7kIb68bf/NOXHegsI43Aksh2Vp9bBQIHD1oP2EEUZERy+gqg6L/pW9Pu0f9m5dJtfogRiV9z9o/Tik93IZpahc8m/gw9WDXj1VYZM0CzJ7uOTXNQBkrr9eT0nZYJiEg6qNWrpFYRgcQo4dGJWPEP3ScvY0eyx7+K/2LnzSDAnJRF9qIF2N6HMkgM1Ov8zJp/enXbqOC76AvxqKLeBjgQAy9Te1camdew8py2RS+iVy7aXQ+utXnxdkH3iSbsdX+eYA/5JnuEUV/9Bdsr0RwKWH30pey0dcbPw== Received: from MW4PR04CA0205.namprd04.prod.outlook.com (2603:10b6:303:86::30) by CY4PR12MB1688.namprd12.prod.outlook.com (2603:10b6:910:8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.26; Tue, 4 May 2021 21:09:39 +0000 Received: from CO1NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::ea) by MW4PR04CA0205.outlook.office365.com (2603:10b6:303:86::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Tue, 4 May 2021 21:09:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT056.mail.protection.outlook.com (10.13.175.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 21:09:39 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 4 May 2021 21:09:37 +0000 From: Matan Azrad To: CC: , , , "Thomas Monjalon" , Shiri Kuzin Date: Wed, 5 May 2021 00:08:51 +0300 Message-ID: <20210504210857.3398397-10-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210504210857.3398397-1-matan@nvidia.com> References: <20210429154712.2820159-1-matan@nvidia.com> <20210504210857.3398397-1-matan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ceda3474-e291-497a-a955-08d90f40ede5 X-MS-TrafficTypeDiagnostic: CY4PR12MB1688: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z9VSKxsAlofuUlHtHl/SNzbZjuOlIdEcxrB2CzKx8lh+wYWswhrclU+zZgc8Aw059jJsrqjbNkFy6WSfxH1uvp0m7PuDftRV5Ll4kTcEMsf7DW63M0x25qia41X3Sjmb4rkPbskBdGeZZsDee41JpPXFg2wVN0rAlB+BlHmYL6adHO9MXCGEBq7WJiIRHIgkAt9lXMrdRl26qQ+vcWCD2TuAMFoExPV/z4JoyrR8jT+jOCBnGhMUuzQL+fwx9FlM0kjuU5Hjzvvv5cx8gSrUizW0OWY2assxasdVs9jdjbCY7avU4z7Lx8sCCD6E5gF0V201sRpLoA5Ye/+TvNK/xW17sAAP4uuWgoSrKZvNUJr+s8YBHOXLPxT5128qQ8k8Q0gWlUmqvurmxXJJwp83QwUGs7BqtaHgroj5yYOz9Thmv9TYiKIopsqyo8Ujhj9cpfrfiFl1UggSCK74jsGr8cvFzVvdMkMeSybRgGsgDSmD4zkYVZ6DqhZtCGdEkqw1rfHFPy6CPCbxwBnrLEAZmGK+yLbfihm6xMLsKMTzR7bmBCr1s4PR1DuxXF8+YbG6CkS+P7E1gzehY3CkpkYWk4fRhfibKhIV4Rpjm6iGivEiHFaQQBWPZ6Wcm7StTEVnU/HWOHJeEOhJ05TbOEW29FEhblRXI28uPFSKhUiZ9MYSsWlGpktVVurXgFi4ChWT2pUrxrl/pu+yyFDEE02IK2wzciHi2zLRgK+xqx4CI5o= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39860400002)(396003)(36840700001)(46966006)(86362001)(5660300002)(7696005)(2906002)(36756003)(82740400003)(47076005)(6666004)(1076003)(8676002)(7636003)(8936002)(36860700001)(70206006)(70586007)(82310400003)(6286002)(316002)(6916009)(478600001)(55016002)(83380400001)(966005)(26005)(2616005)(54906003)(36906005)(4326008)(16526019)(186003)(426003)(336012)(107886003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 21:09:39.1391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ceda3474-e291-497a-a955-08d90f40ede5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1688 Subject: [dpdk-dev] [PATCH v3 09/15] crypto/mlx5: adjust to the multiple data unit API 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: Shiri Kuzin In AES-XTS the data to be encrypted\decrypted does not have to be in multiples of 16B size, the unit of data is called data-unit. As a result of patch [1] a new field is added to the cipher capability, called dataunit_set, where the devices can report the range of supported data-unit sizes. The new field enables saving the data-unit size in the session structure to the block size pointer variable in order to support several data-unit sizes. [1] https://www.mail-archive.com/dev@dpdk.org/msg205337.html Signed-off-by: Shiri Kuzin --- drivers/crypto/mlx5/mlx5_crypto.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index 18b1a6be88..8cc29ced21 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -48,6 +48,11 @@ struct mlx5_crypto_session { * bsf_size, bsf_p_type, encryption_order and encryption standard, * saved in big endian format. */ + uint32_t bsp_res; + /* + * crypto_block_size_pointer and reserved 24 bits saved in big endian + * format. + */ uint32_t iv_offset:16; /* Starting point for Initialisation Vector. */ struct mlx5_crypto_dek *dek; /* Pointer to dek struct. */ @@ -171,6 +176,24 @@ mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev, MLX5_BSF_P_TYPE_CRYPTO << MLX5_BSF_P_TYPE_OFFSET | encryption_order << MLX5_ENCRYPTION_ORDER_OFFSET | MLX5_ENCRYPTION_STANDARD_AES_XTS); + switch (xform->cipher.dataunit_len) { + case 0: + sess_private_data->bsp_res = 0; + break; + case 512: + sess_private_data->bsp_res = rte_cpu_to_be_32 + ((uint32_t)MLX5_BLOCK_SIZE_512B << + MLX5_BLOCK_SIZE_OFFSET); + break; + case 4096: + sess_private_data->bsp_res = rte_cpu_to_be_32 + ((uint32_t)MLX5_BLOCK_SIZE_4096B << + MLX5_BLOCK_SIZE_OFFSET); + break; + default: + DRV_LOG(ERR, "Cipher data unit length is not supported."); + return -ENOTSUP; + } sess_private_data->iv_offset = cipher->iv.offset; sess_private_data->dek_id = rte_cpu_to_be_32(sess_private_data->dek->obj->id & -- 2.25.1