[01/10] common/mlx5: update PRM definitions for regex availability

Message ID 20211022154600.2180938-1-fkelly@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [01/10] common/mlx5: update PRM definitions for regex availability |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure

Commit Message

Francis Kelly Oct. 22, 2021, 3:45 p.m. UTC
  From: Ady Agbarih <adypodoman@gmail.com>

Update PRM hca capabilities definitions as follows:
regexp_version field added - specifies whether BF2 or BF3
regexp field removed
regexp_params field moved
regexp_log_crspace_size field removed
regexp_mmo added - specifies if using regex mmo wqe is supported

Allow regex only if both regexp_params and regexp_mmo are set,
instead of checking regexp_mmo only.

Check version through the new capability field regexp_version instead
of reading crspace register.

Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c |  3 ++-
 drivers/common/mlx5/mlx5_devx_cmds.h |  3 ++-
 drivers/common/mlx5/mlx5_prm.h       | 12 +++++-------
 drivers/regex/mlx5/mlx5_regex.c      | 11 ++---------
 drivers/regex/mlx5/mlx5_rxp_csrs.h   |  2 +-
 5 files changed, 12 insertions(+), 19 deletions(-)
  

Comments

Ori Kam Oct. 24, 2021, 1:38 p.m. UTC | #1
Hi Francis,

> -----Original Message-----
> From: Francis Kelly <fkelly@nvidia.com>
> Sent: Friday, October 22, 2021 6:46 PM
> To: Thomas Monjalon <tmonjalon@nvidia.com>; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>
> Cc: JAMES HUNTER <jamhunter@nvidia.com>; Ady Agbarih <aagbarih@nvidia.com>; dev@dpdk.org;
> Ady Agbarih <adypodoman@gmail.com>
> Subject: [PATCH 01/10] common/mlx5: update PRM definitions for regex availability
> 
> From: Ady Agbarih <adypodoman@gmail.com>
> 
> Update PRM hca capabilities definitions as follows:
> regexp_version field added - specifies whether BF2 or BF3
> regexp field removed
> regexp_params field moved
> regexp_log_crspace_size field removed
> regexp_mmo added - specifies if using regex mmo wqe is supported
> 
> Allow regex only if both regexp_params and regexp_mmo are set,
> instead of checking regexp_mmo only.
> 
> Check version through the new capability field regexp_version instead
> of reading crspace register.
> 
> Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
> ---

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  

Patch

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index fb7c8e986f..f0af94b31c 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -821,7 +821,8 @@  mlx5_devx_cmd_query_hca_attr(void *ctx,
 	attr->sq_ts_format = MLX5_GET(cmd_hca_cap, hcattr, sq_ts_format);
 	attr->steering_format_version =
 		MLX5_GET(cmd_hca_cap, hcattr, steering_format_version);
-	attr->regex = MLX5_GET(cmd_hca_cap, hcattr, regexp);
+	attr->regexp_params = MLX5_GET(cmd_hca_cap, hcattr, regexp_params);
+	attr->regexp_version = MLX5_GET(cmd_hca_cap, hcattr, regexp_version);
 	attr->regexp_num_of_engines = MLX5_GET(cmd_hca_cap, hcattr,
 					       regexp_num_of_engines);
 	/* Read the general_obj_types bitmap and extract the relevant bits. */
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 5e4f3b749e..69b6bed2dd 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -151,7 +151,8 @@  struct mlx5_hca_attr {
 	uint32_t sq_ts_format:2;
 	uint32_t steering_format_version:4;
 	uint32_t qp_ts_format:2;
-	uint32_t regex:1;
+	uint32_t regexp_params:1;
+	uint32_t regexp_version:3;
 	uint32_t reg_c_preserve:1;
 	uint32_t ct_offload:1; /* General obj type ASO CT offload supported. */
 	uint32_t crypto:1; /* Crypto engine is supported. */
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index eab80eaead..8b0f2f1a89 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -1341,16 +1341,13 @@  struct mlx5_ifc_cmd_hca_cap_bits {
 	u8 wqe_index_ignore_cap[0x1];
 	u8 dynamic_qp_allocation[0x1];
 	u8 log_max_qp[0x5];
-	u8 regexp[0x1];
-	u8 reserved_at_a1[0x3];
+	u8 reserved_at_a0[0x4];
 	u8 regexp_num_of_engines[0x4];
 	u8 reserved_at_a8[0x1];
 	u8 reg_c_preserve[0x1];
 	u8 reserved_at_aa[0x1];
 	u8 log_max_srq[0x5];
-	u8 reserved_at_b0[0x3];
-	u8 regexp_log_crspace_size[0x5];
-	u8 reserved_at_b8[0x3];
+	u8 reserved_at_b0[0xb];
 	u8 scatter_fcs_w_decap_disable[0x1];
 	u8 reserved_at_bc[0x4];
 	u8 reserved_at_c0[0x8];
@@ -1506,7 +1503,8 @@  struct mlx5_ifc_cmd_hca_cap_bits {
 	u8 uc[0x1];
 	u8 rc[0x1];
 	u8 uar_4k[0x1];
-	u8 reserved_at_241[0x9];
+	u8 reserved_at_241[0x8];
+	u8 regexp_params[0x1];
 	u8 uar_sz[0x6];
 	u8 port_selection_cap[0x1];
 	u8 reserved_at_251[0x7];
@@ -1523,7 +1521,7 @@  struct mlx5_ifc_cmd_hca_cap_bits {
 	u8 max_wqe_sz_sq[0x10];
 	u8 reserved_at_2a0[0xc];
 	u8 regexp_mmo_sq[0x1];
-	u8 reserved_at_2b0[0x3];
+	u8 regexp_version[0x3];
 	u8 max_wqe_sz_rq[0x10];
 	u8 max_flow_counter_31_16[0x10];
 	u8 max_wqe_sz_sq_dc[0x10];
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index 5aa988be6d..2124fd15f0 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -129,7 +129,6 @@  mlx5_regex_dev_probe(struct rte_device *rte_dev)
 	struct mlx5_hca_attr attr;
 	char name[RTE_REGEXDEV_NAME_MAX_LEN];
 	int ret;
-	uint32_t val;
 
 	ibv = mlx5_os_get_ibv_dev(rte_dev);
 	if (ibv == NULL)
@@ -146,7 +145,7 @@  mlx5_regex_dev_probe(struct rte_device *rte_dev)
 		DRV_LOG(ERR, "Unable to read HCA capabilities.");
 		rte_errno = ENOTSUP;
 		goto dev_error;
-	} else if (((!attr.regex) && (!attr.mmo_regex_sq_en) &&
+	} else if (((!attr.regexp_params) && (!attr.mmo_regex_sq_en) &&
 		(!attr.mmo_regex_qp_en)) || attr.regexp_num_of_engines == 0) {
 		DRV_LOG(ERR, "Not enough capabilities to support RegEx, maybe "
 			"old FW/OFED version?");
@@ -170,13 +169,7 @@  mlx5_regex_dev_probe(struct rte_device *rte_dev)
 	priv->qp_ts_format = attr.qp_ts_format;
 	priv->ctx = ctx;
 	priv->nb_engines = 2; /* attr.regexp_num_of_engines */
-	ret = mlx5_devx_regex_register_read(priv->ctx, 0,
-					    MLX5_RXP_CSR_IDENTIFIER, &val);
-	if (ret) {
-		DRV_LOG(ERR, "CSR read failed!");
-		goto dev_error;
-	}
-	if (val == MLX5_RXP_BF2_IDENTIFIER)
+	if (attr.regexp_version == MLX5_RXP_BF2_IDENTIFIER)
 		priv->is_bf2 = 1;
 	/* Default RXP programming mode to Shared. */
 	priv->prog_mode = MLX5_RXP_SHARED_PROG_MODE;
diff --git a/drivers/regex/mlx5/mlx5_rxp_csrs.h b/drivers/regex/mlx5/mlx5_rxp_csrs.h
index f3ffdfdef2..08cb6f3261 100644
--- a/drivers/regex/mlx5/mlx5_rxp_csrs.h
+++ b/drivers/regex/mlx5/mlx5_rxp_csrs.h
@@ -6,7 +6,7 @@ 
 #define _MLX5_RXP_CSRS_H_
 
 /* BF types */
-#define MLX5_RXP_BF2_IDENTIFIER 0x07055254ul
+#define MLX5_RXP_BF2_IDENTIFIER 0x0
 
 /*
  * Common to all RXP implementations