DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tal Shnaiderman <talshn@nvidia.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <matan@nvidia.com>, <rasland@nvidia.com>,
	<asafp@nvidia.com>, <gakhil@marvell.com>,
	<declan.doherty@intel.com>, <viacheslavo@nvidia.com>,
	<eilong@nvidia.com>
Subject: [dpdk-dev] [RFC PATCH 07/10] crypto/mlx5: use OS agnostic functions for PD operations
Date: Tue, 14 Sep 2021 08:38:30 +0300	[thread overview]
Message-ID: <20210914053833.7760-8-talshn@nvidia.com> (raw)
In-Reply-To: <20210914053833.7760-1-talshn@nvidia.com>

use the functions mlx5_os_alloc_pd, mlx5_os_dealloc_pd
mlx5_os_get_pdn instead of the glue functions to support
PD operations on all OSs.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
 drivers/crypto/mlx5/mlx5_crypto.c | 15 ++++++---------
 drivers/crypto/mlx5/mlx5_crypto.h |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index ccae113770..35319d0115 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -784,7 +784,7 @@ static void
 mlx5_crypto_hw_global_release(struct mlx5_crypto_priv *priv)
 {
 	if (priv->pd != NULL) {
-		claim_zero(mlx5_glue->dealloc_pd(priv->pd));
+		claim_zero(mlx5_os_dealloc_pd(priv->pd));
 		priv->pd = NULL;
 	}
 	if (priv->uar != NULL) {
@@ -801,21 +801,18 @@ mlx5_crypto_pd_create(struct mlx5_crypto_priv *priv)
 	struct mlx5dv_pd pd_info;
 	int ret;
 
-	priv->pd = mlx5_glue->alloc_pd(priv->ctx);
+	priv->pd = mlx5_os_alloc_pd(priv->ctx);
 	if (priv->pd == NULL) {
 		DRV_LOG(ERR, "Failed to allocate PD.");
 		return errno ? -errno : -ENOMEM;
 	}
-	obj.pd.in = priv->pd;
-	obj.pd.out = &pd_info;
-	ret = mlx5_glue->dv_init_obj(&obj, MLX5DV_OBJ_PD);
+	ret = mlx5_os_get_pdn(priv->pd, &priv->pdn);
 	if (ret != 0) {
-		DRV_LOG(ERR, "Fail to get PD object info.");
-		mlx5_glue->dealloc_pd(priv->pd);
+		DRV_LOG(ERR, "Fail to get PDN.");
+		mlx5_os_dealloc_pd(priv->pd);
 		priv->pd = NULL;
 		return -errno;
 	}
-	priv->pdn = pd_info.pdn;
 	return 0;
 #else
 	(void)priv;
@@ -834,7 +831,7 @@ mlx5_crypto_hw_global_prepare(struct mlx5_crypto_priv *priv)
 		priv->uar_addr = mlx5_os_get_devx_uar_reg_addr(priv->uar);
 	if (priv->uar == NULL || priv->uar_addr == NULL) {
 		rte_errno = errno;
-		claim_zero(mlx5_glue->dealloc_pd(priv->pd));
+		claim_zero(mlx5_os_dealloc_pd(priv->pd));
 		DRV_LOG(ERR, "Failed to allocate UAR.");
 		return -1;
 	}
diff --git a/drivers/crypto/mlx5/mlx5_crypto.h b/drivers/crypto/mlx5/mlx5_crypto.h
index d5cc509e42..91e3f438b8 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.h
+++ b/drivers/crypto/mlx5/mlx5_crypto.h
@@ -25,7 +25,7 @@ struct mlx5_crypto_priv {
 	volatile uint64_t *uar_addr;
 	uint32_t pdn; /* Protection Domain number. */
 	uint32_t max_segs_num; /* Maximum supported data segs. */
-	struct ibv_pd *pd;
+	void *pd;
 	struct mlx5_hlist *dek_hlist; /* Dek hash list. */
 	struct rte_cryptodev_config dev_config;
 	struct mlx5_mr_share_cache mr_scache; /* Global shared MR cache. */
-- 
2.16.1.windows.4


  parent reply	other threads:[~2021-09-14  5:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14  5:38 [dpdk-dev] [RFC PATCH 00/10] Support MLX5 crypto driver on Windows Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 01/10] common/mlx5: add DV enums to Windows defs file Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 02/10] common/mlx5: add an agnostic OS function to open device context Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 03/10] common/mlx5: move pdn getter to common driver Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 04/10] common/mlx5: add memory region OS agnostic functions for Linux Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 05/10] crypto/mlx5: replace UNIX functions with EAL functions Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 06/10] crypto/mlx5: use OS agnostic functions for UMEM operations Tal Shnaiderman
2021-09-14  5:38 ` Tal Shnaiderman [this message]
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 08/10] crypto/mlx5: use OS agnostic functions for Verbs operations Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 09/10] crypto/mlx5: fix size of UMR WQE Tal Shnaiderman
2021-09-14  5:38 ` [dpdk-dev] [RFC PATCH 10/10] crypto/mlx5: support on Windows Tal Shnaiderman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210914053833.7760-8-talshn@nvidia.com \
    --to=talshn@nvidia.com \
    --cc=asafp@nvidia.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=eilong@nvidia.com \
    --cc=gakhil@marvell.com \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).