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 357FCA0A02; Tue, 4 May 2021 23:09:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7EB841103; Tue, 4 May 2021 23:09:34 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2087.outbound.protection.outlook.com [40.107.244.87]) by mails.dpdk.org (Postfix) with ESMTP id DF540410E9 for ; Tue, 4 May 2021 23:09:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NHC3qUrdod3sKuos8SbVCmjeySdAz5VM+kEqGNLNMIThfJOpnAO0LkEL3C+vBOp5yYmXIzoOOMkPctcPhefJ6lr/igRP5wQOuL9aJcQvvGznqFt+qQCqR2jdC8yWgyM5hgSJmSdiDoGtPJMxurx8ICdx8yTSYlM6wJtVnj7cvLA0SyZuI5be1rvQurG2Zm24zWEETW17bkkM876JJJTFA83sUy/BMP0hNYYtAljXIE8SscPfyW7RBpOwh2h8hwvawwLD31rImTfWh+B9Gwr3dOF0sR5m4QQ5lYLmaP5/m+Fl91ankMKHm3LJFkGwlXsZ2jQ2FXsklWkrHxgoyBGfXw== 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=zXBygIkeIHuB4JDX18+CvakKA5HGD6he7PTyDgj9uqk=; b=lD3cdJDhJ1xgol2IoX0OTJztyuQ4YIT38JOju2ygYK91VXiG1ywSqJk6tj0+Nkzq2mkv/XzhjNGhJIXsu1Bn6vKRGUVTlRFtwVdDXpOBrE4KVY/z7K0+1B05NBt663EnuV2vnpLl8oTh5SY6jtNkBRqIZswjjwawry9v2tAHE5ZJYpWTK3EC06zuofG6qC8ncx4dtVdwNWS5z8Nobmd51if9dx4hoF6Em8t/IQ2rcWoUt85rHUuH8CLGcOQQpQt/V8SQsWZDzpBjfSVQWNKWEOkJv9Ubq5VrbNhK6hOUGW0KSMvEw9kNo1KRkosJ9b34ydUjIpoJUv2jqLlcWbKyPA== 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=zXBygIkeIHuB4JDX18+CvakKA5HGD6he7PTyDgj9uqk=; b=g2JoSU5z9BJMo9W6sJUrAgJQwo27zBMms8qIQNaHZooXvLmao7+RSX25FL2az512+E7vSyxox9b1mn4vjRVt+M8kz/+FMmxY1MMKRqpMUbPqG/c+lw5oe5XVkC7cMyoT+u409YEOHZxlVAYkZTgN9Rz5XEcbcPU8H6Mb7hS3djrK7ioDN4pfKm1NeIiyWKv79S9KEwCqBd7WFANDhDdDYCcMxUCNOSd/M0VGDg8WVrInCOwnHs3lXNOcDMtFoxUfytrL/lf+AelvKZIG3u5IjQiwdd+YbxYkrvWuigIcz/A+r5LXnisal8G9qcHY2f7txBWdG4qEuoaiUtqzGvUsPQ== Received: from MWHPR18CA0048.namprd18.prod.outlook.com (2603:10b6:320:31::34) by BN9PR12MB5323.namprd12.prod.outlook.com (2603:10b6:408:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Tue, 4 May 2021 21:09:30 +0000 Received: from CO1NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:320:31:cafe::a2) by MWHPR18CA0048.outlook.office365.com (2603:10b6:320:31::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 21:09:30 +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 CO1NAM11FT057.mail.protection.outlook.com (10.13.174.205) 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:30 +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:27 +0000 From: Matan Azrad To: CC: , , , "Thomas Monjalon" , Shiri Kuzin Date: Wed, 5 May 2021 00:08:46 +0300 Message-ID: <20210504210857.3398397-5-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: 71623cfb-618c-408f-bd1f-08d90f40e889 X-MS-TrafficTypeDiagnostic: BN9PR12MB5323: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: /TmArQkCk5Jgntk2wK8Lkpy9Ou6KVXqtanHkTl79EtbWGGH6nBnXfRK08otdgIJ+DcrTMqdvO+YZwo7pd8lGF0p7dQ+bTquoRfaHX/rMkfAMuWQft0nwUDIL2XiKwTnvb6i+PwrHbGVQi37QsStIZgsgjKPv/iVqQ5erwcMJXrd+U2NXkQlOY22DvKck8GQKE5MuVMGkPAJsU2baLENyo0AN4JpOty6nzq1InJtYDs+s6CM8CjE0NMUlqIEbrsMs90dRrb2HQ1qvFWLFPcc2uogdNLzzSzXHHb7quVPKIqc9jZN4trOyr8oZxxCQ+fMEUAroBUHnukaiyGz8xigO0B9ULjPiDjKm64Ba5/vi053IPk+EUhRp2pYJv/nXKFGrgfXNFVUAYQGUvUA2nUEhkLhM2Ks8UtZXHmqVCfRHXo5ShBJsXqC2GeR+HNdCBB7UBl6HXihcuLc46V7443nCSJetE2HeGfEkf4LBUGZJxjo8+GdY5QpXUT7zg0sOmGakfVNi6bci8UUWiv/8bnbHYG/5LDht6xU64mvc3o4ZDKi+4p/kFYdPjjnNz1UcViZgy4mt3jX+JkmL/MGIO+I9YYCQF6TJTf3aeH9oqJqgtlliM0ODzAntQlhtPuZzXtwHBsozYnS6vnt4iQtLCvcQo7hXNyeMcrweqWGHWaYpdvY= 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)(396003)(376002)(346002)(39860400002)(136003)(36840700001)(46966006)(6286002)(82310400003)(83380400001)(2616005)(107886003)(4326008)(26005)(36906005)(82740400003)(186003)(86362001)(6666004)(336012)(426003)(54906003)(55016002)(47076005)(7696005)(1076003)(8676002)(36756003)(316002)(356005)(2906002)(478600001)(36860700001)(70586007)(6916009)(7636003)(5660300002)(70206006)(8936002)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 21:09:30.2221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71623cfb-618c-408f-bd1f-08d90f40e889 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: CO1NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5323 Subject: [dpdk-dev] [PATCH v3 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 32f5077066..cec21dbea7 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