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 972F9A0547; Thu, 29 Apr 2021 17:48:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9327C41342; Thu, 29 Apr 2021 17:48:00 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2068.outbound.protection.outlook.com [40.107.244.68]) by mails.dpdk.org (Postfix) with ESMTP id 9C78241342 for ; Thu, 29 Apr 2021 17:47:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A280TMz2meVtNTFZXeXpizz1KubtHPl39+RkvA9hMl4CBGabnArgf7Be2luAs3Ycn4Vp7jDgtgdhN8fuW5lCjoBqb+N/rtzkcVl4WMwhM+EEI2/Bw5a1uyn+qwf3Yyj21aGDKMj2Z7dTVIpYBFf/INefYWbB4OhzDX98Ddu9fiKLYGVvp1UFpRbAJMmeWjV/kbrCA3zUFWexmVbLI0kJQ5k+MA8f99LURerAlpQnFAmxTowjPYLL7bmnOLfq2LrfL6TBcLzzc75caUPvkTkxayXo5dlrRzYBlHyOztTevD3U+ZGmdJ/2KnuR4Wsbxkp7zLBDu3Wr2TSqGMAoPGltdA== 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=zu+2Gy3GCmzYQjFC5PNCVO4XxMxU3vpgQnKYKANSqP4=; b=naq2m8AqjZ1NbYizhKbx1tF7/mRgiZBjOl/k+GuRW2dJj7a6hBsxOR6Wmklx6I4RCzpRizHRy0XiJXmGfRPcyBtmc248bJ9nCCgPoOhbCOJPxX7dlz2YVb9RLWDgKwdTEkF2ydU1T9f3fGIvJqBBxfOJPXIYmTrdHeQnykKPPxaUHF+SaxxCsuJeAws8WNG4MOg/d/8qvsOFCyHCyPQEUJWN4G2I1BgUX5OLXKCASBFzeeaLG9a1Cci6OSJlOxFvqiwImS9WuBOJL7nQZ5PnFd5Flu/E5L7MTRlBPtcl24qWgmtUxE69EEQO800DKC2zWaM+Q4V71DWFn72c6mDD8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=marvell.com 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=zu+2Gy3GCmzYQjFC5PNCVO4XxMxU3vpgQnKYKANSqP4=; b=q3YAPHn5ML9j7Gs6mldc+lObRm+3wZltv0Fgufz7TUN8rQlVruzCVe7qLAmf5HMUoGbfKNPf7JsfVkmS1Gd+hD0n+/RiCum8fCfe7GlLhL6QOv/96h2oZQiHewbkHwPZ3AUE10eKkB+81VDz5/ZRQ+9+At2tq8LW4i1gSmf6SiR/S6z1TD3FeWLK/F/nZTXdbemws0sxmjpnDMbK4ryosPgYDvaK3gTHbOQWE9pGvBS6vVdH/DqeUMr1eiMu26lFKMdknfIU1RzhGAYElOLlR3uzaRo/dDjsVvZa8kIwhjMpy7ecOwtlnDUo4FAcAWxROWJautJVM/oLQCvGqc+Ahg== Received: from DM5PR10CA0004.namprd10.prod.outlook.com (2603:10b6:4:2::14) by BY5PR12MB4116.namprd12.prod.outlook.com (2603:10b6:a03:210::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Thu, 29 Apr 2021 15:47:57 +0000 Received: from DM6NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:4:2:cafe::45) by DM5PR10CA0004.outlook.office365.com (2603:10b6:4:2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25 via Frontend Transport; Thu, 29 Apr 2021 15:47:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; marvell.com; dkim=none (message not signed) header.d=none;marvell.com; 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 DM6NAM11FT010.mail.protection.outlook.com (10.13.172.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.32 via Frontend Transport; Thu, 29 Apr 2021 15:47:56 +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; Thu, 29 Apr 2021 15:47:54 +0000 From: Matan Azrad To: CC: , , , "Shiri Kuzin" Date: Thu, 29 Apr 2021 18:47:01 +0300 Message-ID: <20210429154712.2820159-5-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210429154712.2820159-1-matan@nvidia.com> References: <20210408204849.9543-1-shirik@nvidia.com> <20210429154712.2820159-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34ba7638-0b3e-4d64-d297-08d90b2628b9 X-MS-TrafficTypeDiagnostic: BY5PR12MB4116: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ipOwfrzoOXmQoVEly7hLnIs6mI02ESHY0Y7VS2zG/KokCbqaR6kYhwKr+BL51yiwCKphOuK6k8XA/X4Sqh5+slsjhWxzGwcj1gP6U4FDF8MrimmR5blt9Afq5J2AgsYIqnsyZeBckzhhsW/ROnCCbMWJzfvA4IzTb6+kFmoFd25u0F+yZW3T5TBKWhyqvFqW/+hMvZ8nkd3lcZ6MuITNq68MycYzODq5aboFWoWWEunt3KxwhSsY4z82FpKkUPuMb9uBoIuMV9momQiagZVnbxBNis6VQJtQhsiE+439nNNI2aI75VEIHeTea+b5pkO2fTbRGyTpe1dYT1PnumT0G9q4+uEq6+psMhAi2UB66pP7ux3nzKfOwRxyD9wK5bg7pOR8b2q0c6nQqRWpMgovYMo/wrRLdXYrmbUjFo6OuRjgHT3cPiLq83ar3Ph6WvRLFU6JQv1RIV2NR1sqD3bEm3td/gBsX8YR3nez/rbaOgrUBbERWVdHdZW6zRzmRvdvuXunKCeOTqvZZAZsPFpyX/BgDk19FicXWOii+Etx2CGdOFI42GErSA1eRCSHVVjofrVkixq2ADE8y9rO3BsqL+Zzxd1T2kLAPcS36fzs7sEc+Psi6H4WAVBVgYenQ+PU+NLJ9w2veH+cKJE1Id8FKeVSxHwJ8sl8uZFRkbesItA= 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)(376002)(136003)(396003)(39860400002)(346002)(36840700001)(46966006)(4326008)(6286002)(47076005)(7696005)(107886003)(26005)(186003)(426003)(16526019)(82310400003)(36756003)(2906002)(6666004)(55016002)(36860700001)(70586007)(1076003)(478600001)(336012)(316002)(36906005)(5660300002)(6916009)(8676002)(86362001)(83380400001)(82740400003)(54906003)(70206006)(8936002)(2616005)(7636003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 15:47:56.8505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34ba7638-0b3e-4d64-d297-08d90b2628b9 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: DM6NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4116 Subject: [dpdk-dev] [PATCH v2 04/15] crypto/mlx5: add basic operations 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 The basic dev control operations are configure, close and get info. Extended the existing support of configure and close: -mlx5_crypto_dev_configure- function used to configure device. -mlx5_crypto_dev_close- function used to close a configured device. Added support of get info function: -mlx5_crypto_dev_infos_get- function used to get specific information of a device. Added config struct to user private data with the fields socket id, number of queue pairs and feature flags to be disabled. Signed-off-by: Shiri Kuzin Acked-by: Matan Azrad --- drivers/crypto/mlx5/mlx5_crypto.c | 46 +++++++++++++++++++++++++++---- drivers/crypto/mlx5/mlx5_crypto.h | 1 + 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index c494ed00d1..cc11cabbea 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -19,6 +19,7 @@ #define MLX5_CRYPTO_DRIVER_NAME mlx5_crypto #define MLX5_CRYPTO_LOG_NAME pmd.crypto.mlx5 +#define MLX5_CRYPTO_MAX_QPS 1024 TAILQ_HEAD(mlx5_crypto_privs, mlx5_crypto_priv) mlx5_crypto_priv_list = TAILQ_HEAD_INITIALIZER(mlx5_crypto_priv_list); @@ -28,6 +29,9 @@ int mlx5_crypto_logtype; uint8_t mlx5_crypto_driver_id; +const struct rte_cryptodev_capabilities + mlx5_crypto_caps[RTE_CRYPTO_OP_TYPE_UNDEFINED]; + static const char mlx5_crypto_drv_name[] = RTE_STR(MLX5_CRYPTO_DRIVER_NAME); static const struct rte_driver mlx5_drv = { @@ -49,22 +53,47 @@ struct mlx5_crypto_session { uint32_t dek_id; /* DEK ID */ } __rte_packed; -static unsigned int -mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused) +static void +mlx5_crypto_dev_infos_get(struct rte_cryptodev *dev, + struct rte_cryptodev_info *dev_info) { - return sizeof(struct mlx5_crypto_session); + RTE_SET_USED(dev); + if (dev_info != NULL) { + dev_info->driver_id = mlx5_crypto_driver_id; + dev_info->feature_flags = 0; + dev_info->capabilities = mlx5_crypto_caps; + dev_info->max_nb_queue_pairs = MLX5_CRYPTO_MAX_QPS; + dev_info->min_mbuf_headroom_req = 0; + dev_info->min_mbuf_tailroom_req = 0; + dev_info->sym.max_nb_sessions = 0; + /* + * If 0, the device does not have any limitation in number of + * sessions that can be used. + */ + } } static int mlx5_crypto_dev_configure(struct rte_cryptodev *dev, - struct rte_cryptodev_config *config __rte_unused) + struct rte_cryptodev_config *config) { struct mlx5_crypto_priv *priv = dev->data->dev_private; + if (config == NULL) { + DRV_LOG(ERR, "Invalid crypto dev configure parameters."); + return -EINVAL; + } + if ((config->ff_disable & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) != 0) { + DRV_LOG(ERR, + "Disabled symmetric crypto feature is not supported."); + return -ENOTSUP; + } if (mlx5_crypto_dek_setup(priv) != 0) { DRV_LOG(ERR, "Dek hash list creation has failed."); return -ENOMEM; } + priv->dev_config = *config; + DRV_LOG(DEBUG, "Device %u was configured.", dev->driver_id); return 0; } @@ -74,9 +103,16 @@ mlx5_crypto_dev_close(struct rte_cryptodev *dev) struct mlx5_crypto_priv *priv = dev->data->dev_private; mlx5_crypto_dek_unset(priv); + DRV_LOG(DEBUG, "Device %u was closed.", dev->driver_id); return 0; } +static unsigned int +mlx5_crypto_sym_session_get_size(struct rte_cryptodev *dev __rte_unused) +{ + return sizeof(struct mlx5_crypto_session); +} + static int mlx5_crypto_sym_session_configure(struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform, @@ -153,7 +189,7 @@ static struct rte_cryptodev_ops mlx5_crypto_ops = { .dev_start = NULL, .dev_stop = NULL, .dev_close = mlx5_crypto_dev_close, - .dev_infos_get = NULL, + .dev_infos_get = mlx5_crypto_dev_infos_get, .stats_get = NULL, .stats_reset = NULL, .queue_pair_setup = NULL, diff --git a/drivers/crypto/mlx5/mlx5_crypto.h b/drivers/crypto/mlx5/mlx5_crypto.h index 4ec67a7e0f..5e270d3d5a 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.h +++ b/drivers/crypto/mlx5/mlx5_crypto.h @@ -24,6 +24,7 @@ struct mlx5_crypto_priv { uint32_t pdn; /* Protection Domain number. */ struct ibv_pd *pd; struct mlx5_hlist *dek_hlist; /* Dek hash list. */ + struct rte_cryptodev_config dev_config; }; struct mlx5_crypto_dek { -- 2.25.1