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 31772A0548; Sun, 9 May 2021 18:05:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EBACB41120; Sun, 9 May 2021 18:05:33 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by mails.dpdk.org (Postfix) with ESMTP id 798824111A for ; Sun, 9 May 2021 18:05:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dzF78bLSJ7w21rjynqQrvk0eED8GormiD/drxClDAy9Tova0Zj5FTJppAWrtJNzUVm2FaTONBt76EJJXtNS9Ecqc7wfAvoOSnpF+9mRpv8Y0MxEDA64xYur66MbioSEiAr1+VZvvB4MbGG36T/UbCPbIxiv9SXXREwS0aeY2Q8LxgqJyBaQSTiflSF4BXb2tDZQ3RUVavO7EbHqZR5TKwjcP7L2TG010WTMGT1sd734oTx5+snrLWE9m9m2PmIR1mrGyfZXPUpAtxhlw89XHhu1haK3eHlsHNQWG6xfdWrRmQhcy1H6fDTwVNy/BqLNSxXHsPuwyqnCNJJJOr9JHRg== 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=iwOKsSkDGJmJYUCdA139wV6fFvhlCuz5CqkP5ggghck=; b=mSWoxVlLSQ6aB5oNfkQzfq5FplD4tHLHnobIZ4FOFY5gj3EbsxmUvfKkW+Ka53Yge0c1EQOu2HGg0BV2qEYVmya7sazlkOFWASazZwBbz+1WDlRdVguiQxJkaQD43tapYZ3NmCG9TOYdQU1varE8Ounx7wkagbVYQM+Np2xUDjIMHlhRqJPaHNzNDXLiunyCEnbnsIVUnwC66vgAPuMg2QWVJKWOw3rzCUG2zWCO3kJ6HLFPF1nDkl0DO/30eFT/v0xTK0I2fS4Vb+gYU7GBtRMRfKdZrF16HMsUax+alNwTXDjVt/aH3y6EZzqRSv7kAE/UEqHuDqHUhh3bkR6M5w== 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=iwOKsSkDGJmJYUCdA139wV6fFvhlCuz5CqkP5ggghck=; b=AGAMKr/OqA8r6L/kTUyc4ALLtd2S6sCMYbLYyEJwK7t0bAJE6ADslul5NEQTfpPAQVVIMEru1XEX0bHpl5fU1Oit67KsMGdRZ0gu5+nlxh88FUHZ5FxsSZzaR/K+xPTrolh/XLYz16qjZRtsBEJWKXM+y8mZvUe3xCJNNjqmYM0ECDY7hVVkmRtB56izTOn07P47mIj48enYdNlS3CGaIOplTAwOqcKjrGqacyL+sLa22qEwWKVngzXMK5/Esvqop7rjFIXWjm58CvC6b9SGdMvItkXhPmP9TmMfrjB8RyaCdfU0eJ1MMXQZy1ardJ/mW1YqFaKMwAiuUmf/o6UWiA== Received: from MW2PR16CA0071.namprd16.prod.outlook.com (2603:10b6:907:1::48) by DM5PR12MB1770.namprd12.prod.outlook.com (2603:10b6:3:108::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.29; Sun, 9 May 2021 16:05:31 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::e9) by MW2PR16CA0071.outlook.office365.com (2603:10b6:907:1::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Sun, 9 May 2021 16:05: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 CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Sun, 9 May 2021 16:05: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; Sun, 9 May 2021 16:05:28 +0000 From: Matan Azrad To: CC: , , , "Thomas Monjalon" , Shiri Kuzin Date: Sun, 9 May 2021 19:04:57 +0300 Message-ID: <20210509160507.224644-5-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210509160507.224644-1-matan@nvidia.com> References: <20210504210857.3398397-1-matan@nvidia.com> <20210509160507.224644-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fa7452d-91f4-4d72-9c1e-08d913044502 X-MS-TrafficTypeDiagnostic: DM5PR12MB1770: 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: DrBziaf3TTiUTzrDaLdbE556nLhKhKluPSGZX9r9F+/b+BnFRmP2tLeHyGjv1UJntWksMdx345l3rEyk8dKYmeWFcBoHYE+hOxeP/ZjhOTvoZVicYZKMiU6/LoTzHjzHcojswA0hblzYgFVUc+J0cBHSwzsecqDzQcOmq1RgNukMbEkHZCbq9qM+OgSZfrnXRtfE8N/Zn9P4/xuweCBI2IF3U6P1+nEZogLf1dLXK0QmEL6CJXtxK0Lce5m3zxUZpFXzd3oiJYI+QcySPl6HZVCQ7AdMlY6Rt+SyCZ2KrVEpsRcx4WHvDwcd2WDBJmj51PT1Yl3ctgImuiU/Me+FZ1WsP0RpoWnARbv7wAOn9M86TkoUWusu/eoTJTiPE/d9mDcV/lUbOUkUitIw+SdEU3VVfD35C0aAWzQWpYP+y0jI86ETQzhfJWuuwCbN0MBKv8dgSSaa+btFTIEZqjQxSRf66VicCur6DZ2XwHO4u8gmUJzvKdBe3U0Rtkz2A4+nxUBts33PYTQdZ2P4AMdN2pn1bT5Tv1hgr6angFuJxrIAeXGoXGgWyNG1nDTqQwwQG6+e5FTbrTawFyjpkkBJvpL2RF16xvgldkVhPGStR0p3z/l0nrL1Wq49/tDsaV8LbtL5DKxL2m5OOMIipSNbTtNUENDpAXdHkMGlzjaf8qI= 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)(39860400002)(396003)(346002)(376002)(136003)(46966006)(36840700001)(86362001)(7696005)(4326008)(2616005)(2906002)(36756003)(82310400003)(8676002)(1076003)(55016002)(36860700001)(82740400003)(7636003)(54906003)(316002)(6916009)(26005)(6286002)(47076005)(426003)(356005)(70586007)(70206006)(16526019)(186003)(83380400001)(8936002)(336012)(5660300002)(107886003)(6666004)(36906005)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2021 16:05:30.7232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fa7452d-91f4-4d72-9c1e-08d913044502 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: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1770 Subject: [dpdk-dev] [PATCH v4 04/14] 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 31d27245be..c1ae012d15 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 = { @@ -54,22 +58,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; } @@ -79,9 +108,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, @@ -177,7 +213,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