DPDK patches and discussions
 help / color / mirror / Atom feed
From: Francis Kelly <fkelly@nvidia.com>
To: <tmonjalon@nvidia.com>, Matan Azrad <matan@nvidia.com>,
	"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
	Ori Kam <orika@nvidia.com>
Cc: <jamhunter@nvidia.com>, <aagbarih@nvidia.com>, <dev@dpdk.org>,
	Ady Agbarih <adypodoman@gmail.com>
Subject: [dpdk-dev] [PATCH 03/10] common/mlx5: update regex DevX commands
Date: Fri, 22 Oct 2021 15:45:53 +0000	[thread overview]
Message-ID: <20211022154600.2180938-3-fkelly@nvidia.com> (raw)
In-Reply-To: <20211022154600.2180938-1-fkelly@nvidia.com>

From: Ady Agbarih <adypodoman@gmail.com>

This patch modifies the SET_REGEXP_PARAMS devx command as follows:
  Remove DB setup devx command. The command is no longer needed
    in DPDK, it will always be invoked by the regex-daemon.
  Add new devx command, for programming rof rules for a specific
    engine. The command takes as an input an mkey of the rof.
    It also introduces a new field_select bit.

Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
---
 drivers/common/mlx5/mlx5_prm.h       | 13 ++++++++-----
 drivers/regex/mlx5/mlx5_regex.c      |  9 +++------
 drivers/regex/mlx5/mlx5_regex.h      |  4 ++--
 drivers/regex/mlx5/mlx5_regex_devx.c | 15 ++++++++-------
 drivers/regex/mlx5/mlx5_rxp.c        | 27 ---------------------------
 5 files changed, 21 insertions(+), 47 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 8b0f2f1a89..fb75f2da4d 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -3710,17 +3710,20 @@ struct mlx5_ifc_parse_graph_flex_out_bits {
 };
 
 struct regexp_params_field_select_bits {
-	u8 reserved_at_0[0x1e];
+	u8 reserved_at_0[0x1d];
+	u8 rof_mkey[0x1];
 	u8 stop_engine[0x1];
-	u8 db_umem_id[0x1];
+	u8 reserved_at_1f[0x1];
 };
 
 struct mlx5_ifc_regexp_params_bits {
 	u8 reserved_at_0[0x1f];
 	u8 stop_engine[0x1];
-	u8 db_umem_id[0x20];
-	u8 db_umem_offset[0x40];
-	u8 reserved_at_80[0x100];
+	u8 reserved_at_20[0x60];
+	u8 rof_mkey[0x20];
+	u8 rof_size[0x20];
+	u8 rof_mkey_va[0x40];
+	u8 reserved_at_100[0x80];
 };
 
 struct mlx5_ifc_set_regexp_params_in_bits {
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index b7175ff8e9..4be36e40c5 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -55,12 +55,9 @@ mlx5_regex_stop(struct rte_regexdev *dev __rte_unused)
 	rte_free(priv->qps);
 	priv->qps = NULL;
 
-	for (i = 0; i < (priv->nb_engines + MLX5_RXP_EM_COUNT); i++) {
-		if (priv->db[i].umem.umem)
-			mlx5_glue->devx_umem_dereg(priv->db[i].umem.umem);
-		rte_free(priv->db[i].ptr);
-		priv->db[i].ptr = NULL;
-	}
+	for (i = 0; i < priv->nb_engines; i++)
+		/* Stop engine. */
+		mlx5_devx_regex_database_stop(priv->ctx, i);
 
 	return 0;
 }
diff --git a/drivers/regex/mlx5/mlx5_regex.h b/drivers/regex/mlx5/mlx5_regex.h
index 329768980d..c9586ae714 100644
--- a/drivers/regex/mlx5/mlx5_regex.h
+++ b/drivers/regex/mlx5/mlx5_regex.h
@@ -119,8 +119,8 @@ int mlx5_devx_regex_register_read(struct ibv_context *ctx, int engine_id,
 				  uint32_t addr, uint32_t *data);
 int mlx5_devx_regex_database_stop(void *ctx, uint8_t engine);
 int mlx5_devx_regex_database_resume(void *ctx, uint8_t engine);
-int mlx5_devx_regex_database_program(void *ctx, uint8_t engine,
-				     uint32_t umem_id, uint64_t umem_offset);
+int mlx5_devx_regex_rules_program(void *ctx, uint8_t engine, uint32_t rof_mkey,
+				uint32_t rof_size, uint64_t db_mkey_offset);
 
 /* mlx5_regex_control.c */
 int mlx5_regex_qp_setup(struct rte_regexdev *dev, uint16_t qp_ind,
diff --git a/drivers/regex/mlx5/mlx5_regex_devx.c b/drivers/regex/mlx5/mlx5_regex_devx.c
index f66d7aa08b..d8515768c3 100644
--- a/drivers/regex/mlx5/mlx5_regex_devx.c
+++ b/drivers/regex/mlx5/mlx5_regex_devx.c
@@ -103,8 +103,8 @@ mlx5_devx_regex_database_resume(void *ctx, uint8_t engine)
 }
 
 int
-mlx5_devx_regex_database_program(void *ctx, uint8_t engine, uint32_t umem_id,
-				 uint64_t umem_offset)
+mlx5_devx_regex_rules_program(void *ctx, uint8_t engine, uint32_t rof_mkey,
+				uint32_t rof_size, uint64_t rof_mkey_va)
 {
 	uint32_t out[MLX5_ST_SZ_DW(set_regexp_params_out)] = {0};
 	uint32_t in[MLX5_ST_SZ_DW(set_regexp_params_in)] = {0};
@@ -112,14 +112,15 @@ mlx5_devx_regex_database_program(void *ctx, uint8_t engine, uint32_t umem_id,
 
 	MLX5_SET(set_regexp_params_in, in, opcode, MLX5_CMD_SET_REGEX_PARAMS);
 	MLX5_SET(set_regexp_params_in, in, engine_id, engine);
-	MLX5_SET(set_regexp_params_in, in, regexp_params.db_umem_id, umem_id);
-	MLX5_SET64(set_regexp_params_in, in, regexp_params.db_umem_offset,
-		   umem_offset);
-	MLX5_SET(set_regexp_params_in, in, field_select.db_umem_id, 1);
+	MLX5_SET(set_regexp_params_in, in, regexp_params.rof_mkey, rof_mkey);
+	MLX5_SET(set_regexp_params_in, in, regexp_params.rof_size, rof_size);
+	MLX5_SET64(set_regexp_params_in, in, regexp_params.rof_mkey_va,
+		   rof_mkey_va);
+	MLX5_SET(set_regexp_params_in, in, field_select.rof_mkey, 1);
 	ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out,
 					  sizeof(out));
 	if (ret) {
-		DRV_LOG(ERR, "Database program failed %d", ret);
+		DRV_LOG(ERR, "Rules program failed %d", ret);
 		rte_errno = errno;
 		return -errno;
 	}
diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c
index 5afdcb35cc..79f063a127 100644
--- a/drivers/regex/mlx5/mlx5_rxp.c
+++ b/drivers/regex/mlx5/mlx5_rxp.c
@@ -33,8 +33,6 @@ rxp_poll_csr_for_value(struct ibv_context *ctx, uint32_t *value,
 		       uint32_t address, uint32_t expected_value,
 		       uint32_t expected_mask, uint32_t timeout_ms, uint8_t id);
 static int
-mlnx_set_database(struct mlx5_regex_priv *priv, uint8_t id, uint8_t db_to_use);
-static int
 mlnx_resume_database(struct mlx5_regex_priv *priv, uint8_t id);
 static int
 mlnx_update_database(struct mlx5_regex_priv *priv, uint8_t id);
@@ -488,11 +486,6 @@ rxp_program_rof(struct mlx5_regex_priv *priv, const char *buf, uint32_t len,
 		}
 
 	}
-	ret = mlnx_set_database(priv, id, db_free);
-	if (ret < 0) {
-		DRV_LOG(ERR, "Failed to register db memory!");
-		goto parse_error;
-	}
 	rte_free(tmp);
 	return 0;
 parse_error:
@@ -500,26 +493,6 @@ rxp_program_rof(struct mlx5_regex_priv *priv, const char *buf, uint32_t len,
 	return ret;
 }
 
-static int
-mlnx_set_database(struct mlx5_regex_priv *priv, uint8_t id, uint8_t db_to_use)
-{
-	int ret;
-	uint32_t umem_id;
-
-	ret = mlx5_devx_regex_database_stop(priv->ctx, id);
-	if (ret < 0) {
-		DRV_LOG(ERR, "stop engine failed!");
-		return ret;
-	}
-	umem_id = mlx5_os_get_umem_id(priv->db[db_to_use].umem.umem);
-	ret = mlx5_devx_regex_database_program(priv->ctx, id, umem_id, 0);
-	if (ret < 0) {
-		DRV_LOG(ERR, "program db failed!");
-		return ret;
-	}
-	return 0;
-}
-
 static int
 mlnx_resume_database(struct mlx5_regex_priv *priv, uint8_t id)
 {
-- 
2.25.1


  parent reply	other threads:[~2021-10-22 15:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 15:45 [dpdk-dev] [PATCH 01/10] common/mlx5: update PRM definitions for regex availability Francis Kelly
2021-10-22 15:45 ` [dpdk-dev] [PATCH 02/10] regex/mlx5: add cleanup code Francis Kelly
2021-10-22 15:45 ` Francis Kelly [this message]
2021-10-24 13:39   ` [dpdk-dev] [PATCH 03/10] common/mlx5: update regex DevX commands Ori Kam
2021-10-22 15:45 ` [dpdk-dev] [PATCH 04/10] regex/mlx5: remove regexp register read/write Francis Kelly
2021-10-24 13:40   ` Ori Kam
2021-10-22 15:45 ` [dpdk-dev] [PATCH 05/10] regex/mlx5: move RXP to CrSpace Francis Kelly
2021-10-24 13:41   ` Ori Kam
2021-10-22 15:45 ` [dpdk-dev] [PATCH 06/10] regex/mlx5: remove start/stop engine API Francis Kelly
2021-10-22 15:45 ` [dpdk-dev] [PATCH 07/10] regex/mlx5: removed redundant rxp csr file Francis Kelly
2021-10-24 13:42   ` Ori Kam
2021-10-22 15:45 ` [dpdk-dev] [PATCH 08/10] regex/mlx5: fix uninitialized QP destroy Francis Kelly
2021-10-24 13:42   ` Ori Kam
2021-10-22 15:45 ` [dpdk-dev] [PATCH 09/10] regex/mlx5: prevent QP double setup Francis Kelly
2021-10-24 13:43   ` Ori Kam
2021-10-22 15:46 ` [dpdk-dev] [PATCH 10/10] doc: updated release notes and mlx5 file Francis Kelly
2021-10-24 13:43   ` Ori Kam
2021-11-03 22:13     ` Thomas Monjalon
2021-10-24 13:38 ` [dpdk-dev] [PATCH 01/10] common/mlx5: update PRM definitions for regex availability Ori Kam

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=20211022154600.2180938-3-fkelly@nvidia.com \
    --to=fkelly@nvidia.com \
    --cc=aagbarih@nvidia.com \
    --cc=adypodoman@gmail.com \
    --cc=dev@dpdk.org \
    --cc=jamhunter@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=tmonjalon@nvidia.com \
    --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).