DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed
@ 2024-03-14 11:42 Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 02/13] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
                   ` (13 more replies)
  0 siblings, 14 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad,
	Mark Bloch
  Cc: dev, mkashani

From: Erez Shitrit <erezsh@nvidia.com>

When the user tries to create a matcher and if failed  with specific
errno (E2BIG) the message will be in debug level and not in warning.
It is a part of a feature when the user re-try to insert a new matching
depends on that errno, no need the annoying message.

Fixes: c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 6 +++---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 35a2ed2048..81d0e0e6df 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -3534,7 +3534,7 @@ mlx5dr_definer_find_best_match_fit(struct mlx5dr_context *ctx,
 		return 0;
 	}
 
-	DR_LOG(ERR, "Unable to find supporting match/jumbo definer combination");
+	DR_LOG(DEBUG, "Unable to find supporting match/jumbo definer combination");
 	rte_errno = E2BIG;
 	return rte_errno;
 }
@@ -3689,7 +3689,7 @@ mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher,
 	/* Find the match definer layout for header layout match union */
 	ret = mlx5dr_definer_find_best_match_fit(ctx, match_definer, match_hl);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create match definer from header layout");
+		DR_LOG(DEBUG, "Failed to create match definer from header layout");
 		goto free_fc;
 	}
 
@@ -4041,7 +4041,7 @@ int mlx5dr_definer_matcher_init(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_definer_calc_layout(matcher, &match_layout, &range_layout);
 	if (ret) {
-		DR_LOG(ERR, "Failed to calculate matcher definer layout");
+		DR_LOG(DEBUG, "Failed to calculate matcher definer layout");
 		return ret;
 	}
 
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 1c64abfa57..1213e7f0ad 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -877,7 +877,7 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)
 	/* Calculate match, range and hash definers */
 	ret = mlx5dr_definer_matcher_init(ctx, matcher);
 	if (ret) {
-		DR_LOG(ERR, "Failed to set matcher templates with match definers");
+		DR_LOG(DEBUG, "Failed to set matcher templates with match definers");
 		return ret;
 	}
 
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 02/13] common/mlx5: fix error in mlx5 prm structs
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 03/13] net/mlx5/hws: fix wrong comment in mlx5dr_send Itamar Gozlan
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Fix wrong reserved size and add helpful comment

Fixes: 365cdf5f8ce ("net/mlx5/hws: add command layer")

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c671c75bfd..c6846cdb7e 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -2360,8 +2360,8 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
 	u8 reserved_at_d0[0x3];
 	u8 log_conn_track_max_alloc[0x5];
 	u8 reserved_at_d8[0x3];
-	u8 log_max_conn_track_offload[0x5];
-	u8 cross_vhca_object_to_object_supported[0x20]; /* End of DW7. */
+	u8 log_max_conn_track_offload[0x5]; /* End of DW7. */
+	u8 cross_vhca_object_to_object_supported[0x20];
 	u8 allowed_object_for_other_vhca_access_high[0x20];
 	u8 allowed_object_for_other_vhca_access[0x20];
 	u8 reserved_at_140[0x20];
@@ -3655,7 +3655,7 @@ struct mlx5_ifc_stc_ste_param_vport_bits {
 	u8 eswitch_owner_vhca_id[0x10];
 	u8 vport_number[0x10];
 	u8 eswitch_owner_vhca_id_valid[0x1];
-	u8 reserved_at_21[0x59];
+	u8 reserved_at_21[0x5f];
 };
 
 union mlx5_ifc_stc_param_bits {
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 03/13] net/mlx5/hws: fix wrong comment in mlx5dr_send
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 02/13] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 04/13] net/mlx5/hws: remove unused capabilities and fields Itamar Gozlan
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad,
	Mark Bloch
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Remove comment that documents parameter that doesn't exist.

Fixes: 3eb748869d2d ("net/mlx5/hws: add send layer")

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_send.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_send.h b/drivers/net/mlx5/hws/mlx5dr_send.h
index c4eaea52ab..0c89faa8a7 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.h
+++ b/drivers/net/mlx5/hws/mlx5dr_send.h
@@ -203,8 +203,6 @@ struct mlx5dr_send_ste_attr {
  *   value to write in CPU endian format.
  * @param addr
  *   Address to write to.
- * @param lock
- *   Address of the lock to use for that UAR access.
  */
 static __rte_always_inline void
 mlx5dr_uar_write64_relaxed(uint64_t val, void *addr)
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 04/13] net/mlx5/hws: remove unused capabilities and fields
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 02/13] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 03/13] net/mlx5/hws: fix wrong comment in mlx5dr_send Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 05/13] net/mlx5/hws: return -rte_errno on rule creation failure Itamar Gozlan
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

The following caps were never in use:
 - wire_regc
 - metadata_c
 - metadata_c_mask
Also send ring's reg_addr field wasn't in use.

Removing these caps and fields from structs and removing
the code that queried them.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c  | 11 ++---------
 drivers/net/mlx5/hws/mlx5dr_cmd.h  |  3 ---
 drivers/net/mlx5/hws/mlx5dr_send.c |  1 -
 drivers/net/mlx5/hws/mlx5dr_send.h |  1 -
 4 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index 0e0cc479a6..666d678b42 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -1344,12 +1344,10 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 	strlcpy(caps->fw_ver, attr_ex.orig_attr.fw_ver, sizeof(caps->fw_ver));
 
 	port_info = flow_hw_get_wire_port(ctx);
-	if (port_info) {
-		caps->wire_regc = port_info->regc_value;
+	if (port_info)
 		caps->wire_regc_mask = port_info->regc_mask;
-	} else {
+	else
 		DR_LOG(INFO, "Failed to query wire port regc value");
-	}
 
 	return ret;
 }
@@ -1374,10 +1372,5 @@ int mlx5dr_cmd_query_ib_port(struct ibv_context *ctx,
 	vport_caps->vport_num = port_info.vport_id;
 	vport_caps->esw_owner_vhca_id = port_info.esw_owner_vhca_id;
 
-	if (port_info.query_flags & MLX5_PORT_QUERY_REG_C0) {
-		vport_caps->metadata_c = port_info.vport_meta_tag;
-		vport_caps->metadata_c_mask = port_info.vport_meta_mask;
-	}
-
 	return 0;
 }
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index 9d385fc57f..ea5d346d8e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -194,8 +194,6 @@ struct mlx5dr_cmd_query_ft_caps {
 struct mlx5dr_cmd_query_vport_caps {
 	uint16_t vport_num;
 	uint16_t esw_owner_vhca_id;
-	uint32_t metadata_c;
-	uint32_t metadata_c_mask;
 };
 
 struct mlx5dr_cmd_generate_wqe_attr {
@@ -207,7 +205,6 @@ struct mlx5dr_cmd_generate_wqe_attr {
 };
 
 struct mlx5dr_cmd_query_caps {
-	uint32_t wire_regc;
 	uint32_t wire_regc_mask;
 	uint32_t flex_protocols;
 	uint8_t wqe_based_update;
diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index f749401c6f..d58fdb108f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -729,7 +729,6 @@ static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx,
 	buf_sz = queue->num_entries * MAX_WQES_PER_RULE;
 	sq_log_buf_sz = log2above(buf_sz);
 	sq_buf_sz = 1 << (sq_log_buf_sz + log2above(MLX5_SEND_WQE_BB));
-	sq->reg_addr = queue->uar->reg_addr;
 
 	page_size = sysconf(_SC_PAGESIZE);
 	buf_aligned = align(sq_buf_sz, page_size);
diff --git a/drivers/net/mlx5/hws/mlx5dr_send.h b/drivers/net/mlx5/hws/mlx5dr_send.h
index 0c89faa8a7..48593adbed 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.h
+++ b/drivers/net/mlx5/hws/mlx5dr_send.h
@@ -114,7 +114,6 @@ struct mlx5dr_send_ring_sq {
 	char *buf;
 	uint32_t sqn;
 	__be32 *db;
-	void *reg_addr;
 	uint16_t cur_post;
 	uint16_t buf_mask;
 	struct mlx5dr_send_ring_priv *wr_priv;
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 05/13] net/mlx5/hws: return -rte_errno on rule creation failure
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (2 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 04/13] net/mlx5/hws: remove unused capabilities and fields Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 06/13] net/mlx5/hws: simplify send_queues_close code Itamar Gozlan
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

mlx5dr_rule_create returns -ret, so internal functions should return
rte_errno on failure. Fix return values of the function that creates
rule in root table.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index f14e1e6ecd..7bcf2de55f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -733,7 +733,7 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule,
 free_attr:
 	simple_free(attr);
 
-	return -rte_errno;
+	return rte_errno;
 }
 
 static int mlx5dr_rule_destroy_root(struct mlx5dr_rule *rule,
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 06/13] net/mlx5/hws: simplify send_queues_close code
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (3 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 05/13] net/mlx5/hws: return -rte_errno on rule creation failure Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 07/13] net/mlx5/hws: fix error flow in mlx5dr_context_open Itamar Gozlan
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Small simplification to the send_queues_close code

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_send.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index d58fdb108f..d61862f074 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -970,13 +970,8 @@ int mlx5dr_send_queue_open(struct mlx5dr_context *ctx,
 
 static void __mlx5dr_send_queues_close(struct mlx5dr_context *ctx, uint16_t queues)
 {
-	struct mlx5dr_send_engine *queue;
-
-	while (queues--) {
-		queue = &ctx->send_queue[queues];
-
-		mlx5dr_send_queue_close(queue);
-	}
+	while (queues--)
+		mlx5dr_send_queue_close(&ctx->send_queue[queues]);
 }
 
 void mlx5dr_send_queues_close(struct mlx5dr_context *ctx)
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 07/13] net/mlx5/hws: fix error flow in mlx5dr_context_open
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (4 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 06/13] net/mlx5/hws: simplify send_queues_close code Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 08/13] net/mlx5/hws: fix code analysis error in passing 0 enum val Itamar Gozlan
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Add missing spinlock destruction in error flow.

Fixes: b0290e56dd08 ("net/mlx5/hws: add context object")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_context.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_context.c b/drivers/net/mlx5/hws/mlx5dr_context.c
index 15d53c578a..7f120b3b1b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_context.c
+++ b/drivers/net/mlx5/hws/mlx5dr_context.c
@@ -263,6 +263,7 @@ struct mlx5dr_context *mlx5dr_context_open(struct ibv_context *ibv_ctx,
 free_caps:
 	simple_free(ctx->caps);
 free_ctx:
+	pthread_spin_destroy(&ctx->ctrl_lock);
 	simple_free(ctx);
 	return NULL;
 }
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 08/13] net/mlx5/hws: fix code analysis error in passing 0 enum val
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (5 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 07/13] net/mlx5/hws: fix error flow in mlx5dr_context_open Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 09/13] net/mlx5/hws: simplify code for updating CQ doorbell record Itamar Gozlan
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Instead of passing 0 as an enum parameter, define flag NONE.
This resolves the following code analysis error: "enumerated
type mixed with another type".
This value is currently used in tests only, and will later
be used in backward-compatible steering API.

Fixes: 5cadd74fbc08 ("net/mlx5: add HW steering low-level abstract stub")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 80e118a980..d2c426e679 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -82,6 +82,7 @@ enum mlx5dr_action_aso_ct_flags {
 };
 
 enum mlx5dr_match_template_flags {
+	MLX5DR_MATCH_TEMPLATE_FLAG_NONE = 0,
 	/* Allow relaxed matching by skipping derived dependent match fields. */
 	MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH = 1,
 };
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 09/13] net/mlx5/hws: simplify code for updating CQ doorbell record
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (6 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 08/13] net/mlx5/hws: fix code analysis error in passing 0 enum val Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 10/13] net/mlx5/hws: fix rule is in resize check Itamar Gozlan
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Simplify the code that does CQ poll - have DB record
update as part of CQ polling.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_send.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index d61862f074..2942668e76 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -594,7 +594,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue,
 	    cqe_owner != sw_own)
 		return;
 
-	if (unlikely(mlx5dv_get_cqe_opcode(cqe) != MLX5_CQE_REQ))
+	if (unlikely(cqe_opcode != MLX5_CQE_REQ))
 		queue->err = true;
 
 	rte_io_rmb();
@@ -611,6 +611,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue,
 	cq->poll_wqe = (wqe_cnt + priv->num_wqebbs) & sq->buf_mask;
 	mlx5dr_send_engine_update(queue, cqe, priv, res, i, res_nb, wqe_cnt);
 	cq->cons_index++;
+	*cq->db = htobe32(cq->cons_index & 0xffffff);
 }
 
 static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue,
@@ -620,13 +621,9 @@ static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue,
 {
 	int j;
 
-	for (j = 0; j < MLX5DR_NUM_SEND_RINGS; j++) {
+	for (j = 0; j < MLX5DR_NUM_SEND_RINGS; j++)
 		mlx5dr_send_engine_poll_cq(queue, &queue->send_ring[j],
 					   res, polled, res_nb);
-
-		*queue->send_ring[j].send_cq.db =
-			htobe32(queue->send_ring[j].send_cq.cons_index & 0xffffff);
-	}
 }
 
 static void mlx5dr_send_engine_poll_list(struct mlx5dr_send_engine *queue,
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 10/13] net/mlx5/hws: fix rule is in resize check
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (7 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 09/13] net/mlx5/hws: simplify code for updating CQ doorbell record Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 11/13] net/mlx5/hws: drop at attach number of actions Itamar Gozlan
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Alex Vesker <valex@nvidia.com>

The check to detect if a rule is in resize was done incorrectly,
this can lead to an incorrect function call upon completion for
rules which are not in resize (move).
Since the resize_info is in a union we cannot rely only on the
pointer value but also need to make sure the matcher is in resize
process, this assures us the resize info is valid.

Fixes: 762feceb8294 ("net/mlx5/hws: support resizable matchers")
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 7 +++++++
 drivers/net/mlx5/hws/mlx5dr_rule.h | 6 +-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 7bcf2de55f..3e8e90ba76 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -350,6 +350,13 @@ static void mlx5dr_rule_move_init(struct mlx5dr_rule *rule,
 	rule->resize_info->state = MLX5DR_RULE_RESIZE_STATE_WRITING;
 }
 
+bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule)
+{
+	return unlikely(mlx5dr_matcher_is_in_resize(rule->matcher)) &&
+	       rule->resize_info &&
+	       rule->resize_info->state != MLX5DR_RULE_RESIZE_STATE_IDLE;
+}
+
 static int mlx5dr_rule_create_hws_fw_wqe(struct mlx5dr_rule *rule,
 					 struct mlx5dr_rule_attr *attr,
 					 uint8_t mt_idx,
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.h b/drivers/net/mlx5/hws/mlx5dr_rule.h
index 07adf9c5ad..dffaec1c0f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.h
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.h
@@ -72,10 +72,6 @@ int mlx5dr_rule_move_hws_remove(struct mlx5dr_rule *rule,
 int mlx5dr_rule_move_hws_add(struct mlx5dr_rule *rule,
 			     struct mlx5dr_rule_attr *attr);
 
-static inline bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule)
-{
-	return rule->resize_info &&
-	       rule->resize_info->state != MLX5DR_RULE_RESIZE_STATE_IDLE;
-}
+bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule);
 
 #endif /* MLX5DR_RULE_H_ */
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 11/13] net/mlx5/hws: drop at attach number of actions
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (8 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 10/13] net/mlx5/hws: fix rule is in resize check Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 12/13] net/mlx5/hws: extending tag saving for match and jumbo Itamar Gozlan
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Alex Vesker <valex@nvidia.com>

Requesting the user for number of action resources is
not defined well enough, instead the user should provide
an initial action template which should contain the
future attached action templates.

Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 1213e7f0ad..78d525e578 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -785,6 +785,13 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)
 	if (matcher->flags & MLX5DR_MATCHER_FLAGS_COLLISION)
 		return 0;
 
+	if (matcher->attr.max_num_of_at_attach &&
+	    mlx5dr_matcher_req_fw_wqe(matcher)) {
+		DR_LOG(ERR, "FW extended matcher doesn't support additional at");
+		rte_errno = ENOTSUP;
+		return rte_errno;
+	}
+
 	for (i = 0; i < matcher->num_of_at; i++) {
 		struct mlx5dr_action_template *at = &matcher->at[i];
 
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 12/13] net/mlx5/hws: extending tag saving for match and jumbo
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (9 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 11/13] net/mlx5/hws: drop at attach number of actions Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-14 11:42 ` [PATCH 13/13] net/mlx5/hws: fix port ID for root matcher and rule Itamar Gozlan
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Erez Shitrit <erezsh@nvidia.com>

Save the exact tag when matching over jumbo masking.

Fixes: 348cdeec6472 ("net/mlx5/hws: add FW WQE rule creation logic")

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 3e8e90ba76..d56677a1a5 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -195,8 +195,13 @@ mlx5dr_rule_save_delete_info(struct mlx5dr_rule *rule,
 		rule->tag_ptr = simple_calloc(2, sizeof(*rule->tag_ptr));
 		assert(rule->tag_ptr);
 
-		src_tag = (uint8_t *)ste_attr->wqe_data->tag;
-		memcpy(rule->tag_ptr[0].match, src_tag, MLX5DR_MATCH_TAG_SZ);
+		if (is_jumbo)
+			memcpy(rule->tag_ptr[0].jumbo, ste_attr->wqe_data->action,
+			       MLX5DR_JUMBO_TAG_SZ);
+		else
+			memcpy(rule->tag_ptr[0].match, ste_attr->wqe_data->tag,
+			       MLX5DR_MATCH_TAG_SZ);
+
 		rule->tag_ptr[1].reserved[0] = ste_attr->send_attr.match_definer_id;
 
 		/* Save range definer id and tag for delete */
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 13/13] net/mlx5/hws: fix port ID for root matcher and rule
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (10 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 12/13] net/mlx5/hws: extending tag saving for match and jumbo Itamar Gozlan
@ 2024-03-14 11:42 ` Itamar Gozlan
  2024-03-18 12:56 ` [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Raslan Darawsheh
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
  13 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-03-14 11:42 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, valex, viacheslavo, thomas,
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad
  Cc: dev, mkashani

From: Erez Shitrit <erezsh@nvidia.com>

In root tables matcher and rule need to have their port-id, otherwise
the translate function that done in dpdk layer will not get the right
attributes.
For that whenever the matcher is matching the source-port we need to get
the relevant port-id before calling the translate function.

Fixes: 405242c52dd5 ("net/mlx5/hws: add rule object")
Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 17 +++++++++++++++++
 drivers/net/mlx5/hws/mlx5dr_rule.c    | 18 ++++++++++++++++++
 drivers/net/mlx5/mlx5_flow.h          | 18 ++++++++++++++++++
 3 files changed, 53 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 78d525e578..394244b55b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -1227,6 +1227,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher)
 	struct mlx5dv_flow_match_parameters *mask;
 	struct mlx5_flow_attr flow_attr = {0};
 	struct rte_flow_error rte_error;
+	struct rte_flow_item *item;
 	uint8_t match_criteria;
 	int ret;
 
@@ -1255,6 +1256,22 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher)
 		return rte_errno;
 	}
 
+	/* We need the port id in case of matching representor */
+	item = matcher->mt[0].items;
+	while (item->type != RTE_FLOW_ITEM_TYPE_END) {
+		if (item->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR ||
+		    item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) {
+			ret = flow_hw_get_port_id_from_ctx(ctx, &flow_attr.port_id);
+			if (ret) {
+				DR_LOG(ERR, "Failed to get port id for dev %s",
+				       ctx->ibv_ctx->device->name);
+				rte_errno = EINVAL;
+				return rte_errno;
+			}
+		}
+		++item;
+	}
+
 	mask = simple_calloc(1, MLX5_ST_SZ_BYTES(fte_match_param) +
 			     offsetof(struct mlx5dv_flow_match_parameters, match_buf));
 	if (!mask) {
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index d56677a1a5..5dae4f3442 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -692,10 +692,28 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule,
 	struct mlx5dv_flow_match_parameters *value;
 	struct mlx5_flow_attr flow_attr = {0};
 	struct mlx5dv_flow_action_attr *attr;
+	const struct rte_flow_item *cur_item;
 	struct rte_flow_error error;
 	uint8_t match_criteria;
 	int ret;
 
+	/* We need the port id in case of matching representor */
+	cur_item = items;
+	while (cur_item->type != RTE_FLOW_ITEM_TYPE_END) {
+		if (cur_item->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR ||
+		    cur_item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) {
+			ret = flow_hw_get_port_id_from_ctx(rule->matcher->tbl->ctx,
+							   &flow_attr.port_id);
+			if (ret) {
+				DR_LOG(ERR, "Failed to get port id for dev %s",
+				       rule->matcher->tbl->ctx->ibv_ctx->device->name);
+				rte_errno = EINVAL;
+				return rte_errno;
+			}
+		}
+		++cur_item;
+	}
+
 	attr = simple_calloc(num_actions, sizeof(*attr));
 	if (!attr) {
 		rte_errno = ENOMEM;
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 34b5e0f45b..e435a686fd 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -2001,6 +2001,24 @@ flow_hw_get_reg_id(struct rte_eth_dev *dev,
 #endif
 }
 
+static __rte_always_inline int
+flow_hw_get_port_id_from_ctx(void *dr_ctx, uint32_t *port_val)
+{
+	uint32_t port;
+
+	MLX5_ETH_FOREACH_DEV(port, NULL) {
+		struct mlx5_priv *priv;
+		priv = rte_eth_devices[port].data->dev_private;
+
+		if (priv->dr_ctx == dr_ctx) {
+			*port_val = port;
+			return 0;
+		}
+	}
+
+	return -EINVAL;
+}
+
 /**
  * Get GENEVE TLV option FW information according type and class.
  *
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* RE: [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (11 preceding siblings ...)
  2024-03-14 11:42 ` [PATCH 13/13] net/mlx5/hws: fix port ID for root matcher and rule Itamar Gozlan
@ 2024-03-18 12:56 ` Raslan Darawsheh
  2024-03-18 14:48   ` Thomas Monjalon
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
  13 siblings, 1 reply; 33+ messages in thread
From: Raslan Darawsheh @ 2024-03-18 12:56 UTC (permalink / raw)
  To: Itamar Gozlan, Itamar Gozlan, Erez Shitrit, Hamdan Agbariya,
	Yevgeny Kliteynik, Alex Vesker, Slava Ovsiienko,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad,
	Mark Bloch
  Cc: dev, Maayan Kashani

Hi,

> -----Original Message-----
> From: Itamar Gozlan <igozlan@nvidia.com>
> Sent: Thursday, March 14, 2024 1:42 PM
> To: Itamar Gozlan <igozlan@nvidia.com>; Erez Shitrit <erezsh@nvidia.com>;
> Hamdan Agbariya <hamdani@nvidia.com>; Yevgeny Kliteynik
> <kliteyn@nvidia.com>; Alex Vesker <valex@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>; Dariusz Sosnowski <dsosnowski@nvidia.com>; Ori
> Kam <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Mark Bloch <mbloch@nvidia.com>
> Cc: dev@dpdk.org; Maayan Kashani <mkashani@nvidia.com>
> Subject: [PATCH 01/13] net/mlx5/hws: move warn into debug level when
> needed
> 
> From: Erez Shitrit <erezsh@nvidia.com>
> 
> When the user tries to create a matcher and if failed  with specific errno
> (E2BIG) the message will be in debug level and not in warning.
> It is a part of a feature when the user re-try to insert a new matching depends
> on that errno, no need the annoying message.
> 
> Fixes: c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")
> 
> Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Fixed Cc stable on several patches on this series, and reworded the commits
Series applied to next-net-mlx,

Kindest regards
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed
  2024-03-18 12:56 ` [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Raslan Darawsheh
@ 2024-03-18 14:48   ` Thomas Monjalon
  2024-03-19  7:33     ` Raslan Darawsheh
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Monjalon @ 2024-03-18 14:48 UTC (permalink / raw)
  To: Itamar Gozlan, Erez Shitrit, Hamdan Agbariya, Yevgeny Kliteynik,
	Alex Vesker, Raslan Darawsheh
  Cc: Slava Ovsiienko, Dariusz Sosnowski, Ori Kam, Suanming Mou,
	Matan Azrad, Mark Bloch, dev, Maayan Kashani

18/03/2024 13:56, Raslan Darawsheh:
> From: Itamar Gozlan <igozlan@nvidia.com>
> > From: Erez Shitrit <erezsh@nvidia.com>
> > 
> > When the user tries to create a matcher and if failed  with specific errno
> > (E2BIG) the message will be in debug level and not in warning.
> > It is a part of a feature when the user re-try to insert a new matching depends
> > on that errno, no need the annoying message.
> > 
> > Fixes: c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")
> > 
> > Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
> > Acked-by: Matan Azrad <matan@nvidia.com>
> Fixed Cc stable on several patches on this series, and reworded the commits
> Series applied to next-net-mlx,

There is no cover letter for this series,
so we are not able to understand how critical it is,
and what is the general intent.

Is it supposed to be integrated in the last week of 24.03 release cycle?



^ permalink raw reply	[flat|nested] 33+ messages in thread

* RE: [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed
  2024-03-18 14:48   ` Thomas Monjalon
@ 2024-03-19  7:33     ` Raslan Darawsheh
  2024-03-20 16:35       ` Yevgeny Kliteynik
  0 siblings, 1 reply; 33+ messages in thread
From: Raslan Darawsheh @ 2024-03-19  7:33 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon (EXTERNAL),
	Itamar Gozlan, Erez Shitrit, Hamdan Agbariya, Yevgeny Kliteynik,
	Alex Vesker
  Cc: Slava Ovsiienko, Dariusz Sosnowski, Ori Kam, Suanming Mou,
	Matan Azrad, Mark Bloch, dev, Maayan Kashani

Hi,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, March 18, 2024 4:49 PM
> To: Itamar Gozlan <igozlan@nvidia.com>; Erez Shitrit <erezsh@nvidia.com>;
> Hamdan Agbariya <hamdani@nvidia.com>; Yevgeny Kliteynik
> <kliteyn@nvidia.com>; Alex Vesker <valex@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>
> Cc: Slava Ovsiienko <viacheslavo@nvidia.com>; Dariusz Sosnowski
> <dsosnowski@nvidia.com>; Ori Kam <orika@nvidia.com>; Suanming Mou
> <suanmingm@nvidia.com>; Matan Azrad <matan@nvidia.com>; Mark Bloch
> <mbloch@nvidia.com>; dev@dpdk.org; Maayan Kashani
> <mkashani@nvidia.com>
> Subject: Re: [PATCH 01/13] net/mlx5/hws: move warn into debug level when
> needed
> 
> 18/03/2024 13:56, Raslan Darawsheh:
> > From: Itamar Gozlan <igozlan@nvidia.com>
> > > From: Erez Shitrit <erezsh@nvidia.com>
> > >
> > > When the user tries to create a matcher and if failed  with specific
> > > errno
> > > (E2BIG) the message will be in debug level and not in warning.
> > > It is a part of a feature when the user re-try to insert a new
> > > matching depends on that errno, no need the annoying message.
> > >
> > > Fixes: c55c2bf3533 ("net/mlx5/hws: net/mlx5/hws: add definer layer")
> > >
> > > Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
> > > Acked-by: Matan Azrad <matan@nvidia.com>
> > Fixed Cc stable on several patches on this series, and reworded the
> > commits Series applied to next-net-mlx,
> 
> There is no cover letter for this series, so we are not able to understand how
> critical it is, and what is the general intent.
> 
> Is it supposed to be integrated in the last week of 24.03 release cycle?
> 
No, it's not critical for RC4 It's my fault, I'll drop it for now and we'll merge it in the next release cycle only.

Kindest regards
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed
  2024-03-19  7:33     ` Raslan Darawsheh
@ 2024-03-20 16:35       ` Yevgeny Kliteynik
  0 siblings, 0 replies; 33+ messages in thread
From: Yevgeny Kliteynik @ 2024-03-20 16:35 UTC (permalink / raw)
  To: Raslan Darawsheh, NBU-Contact-Thomas Monjalon (EXTERNAL),
	Itamar Gozlan, Erez Shitrit, Hamdan Agbariya, Alex Vesker
  Cc: Slava Ovsiienko, Dariusz Sosnowski, Ori Kam, Suanming Mou,
	Matan Azrad, Mark Bloch, dev, Maayan Kashani

On 19-Mar-24 09:33, Raslan Darawsheh wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Thomas Monjalon <thomas@monjalon.net>
>>
>> 18/03/2024 13:56, Raslan Darawsheh:
>>> From: Itamar Gozlan <igozlan@nvidia.com>
>>
>> There is no cover letter for this series, so we are not able to understand how
>> critical it is, and what is the general intent.
>>
>> Is it supposed to be integrated in the last week of 24.03 release cycle?
>>
> No, it's not critical for RC4 It's my fault, I'll drop it for now and we'll merge it in the next release cycle only.

Actually, this series contain a bugfix for a show stopper bug:
   [DPDK Upstream - Bug SW #3808915] Seg fault on dequeue flow

The fix is in patch 10/13:
   [PATCH 10/13] net/mlx5/hws: fix rule is in resize check

-- YK

> Kindest regards
> Raslan Darawsheh


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 01/16] net/mlx5/hws: move warn into debug level when needed
  2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
                   ` (12 preceding siblings ...)
  2024-03-18 12:56 ` [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Raslan Darawsheh
@ 2024-05-06 11:44 ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 02/16] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
                     ` (14 more replies)
  13 siblings, 15 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Mark Bloch,
	Alex Vesker
  Cc: dev, stable

From: Erez Shitrit <erezsh@nvidia.com>

When the user tries to create a matcher and if failed  with specific
errno (E2BIG) the message will be in debug level and not in warning.
It is a part of a feature when the user re-try to insert a new matching
depends on that errno, no need the annoying message.

Fixes: c55c2bf35333 ("net/mlx5/hws: add definer layer")
Cc: stable@dpdk.org

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 6 +++---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 35a2ed2048..81d0e0e6df 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -3534,7 +3534,7 @@ mlx5dr_definer_find_best_match_fit(struct mlx5dr_context *ctx,
 		return 0;
 	}
 
-	DR_LOG(ERR, "Unable to find supporting match/jumbo definer combination");
+	DR_LOG(DEBUG, "Unable to find supporting match/jumbo definer combination");
 	rte_errno = E2BIG;
 	return rte_errno;
 }
@@ -3689,7 +3689,7 @@ mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher,
 	/* Find the match definer layout for header layout match union */
 	ret = mlx5dr_definer_find_best_match_fit(ctx, match_definer, match_hl);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create match definer from header layout");
+		DR_LOG(DEBUG, "Failed to create match definer from header layout");
 		goto free_fc;
 	}
 
@@ -4041,7 +4041,7 @@ int mlx5dr_definer_matcher_init(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_definer_calc_layout(matcher, &match_layout, &range_layout);
 	if (ret) {
-		DR_LOG(ERR, "Failed to calculate matcher definer layout");
+		DR_LOG(DEBUG, "Failed to calculate matcher definer layout");
 		return ret;
 	}
 
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 1c64abfa57..1213e7f0ad 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -877,7 +877,7 @@ static int mlx5dr_matcher_bind_mt(struct mlx5dr_matcher *matcher)
 	/* Calculate match, range and hash definers */
 	ret = mlx5dr_definer_matcher_init(ctx, matcher);
 	if (ret) {
-		DR_LOG(ERR, "Failed to set matcher templates with match definers");
+		DR_LOG(DEBUG, "Failed to set matcher templates with match definers");
 		return ret;
 	}
 
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 02/16] common/mlx5: fix error in mlx5 prm structs
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 03/16] net/mlx5/hws: fix wrong comment in mlx5dr send Itamar Gozlan
                     ` (13 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Alex Vesker
  Cc: dev, stable

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Fix wrong reserved size and add helpful comment

Fixes: 365cdf5f8ce7 ("net/mlx5/hws: add command layer")
Cc: stable@dpdk.org

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c671c75bfd..c6846cdb7e 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -2360,8 +2360,8 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
 	u8 reserved_at_d0[0x3];
 	u8 log_conn_track_max_alloc[0x5];
 	u8 reserved_at_d8[0x3];
-	u8 log_max_conn_track_offload[0x5];
-	u8 cross_vhca_object_to_object_supported[0x20]; /* End of DW7. */
+	u8 log_max_conn_track_offload[0x5]; /* End of DW7. */
+	u8 cross_vhca_object_to_object_supported[0x20];
 	u8 allowed_object_for_other_vhca_access_high[0x20];
 	u8 allowed_object_for_other_vhca_access[0x20];
 	u8 reserved_at_140[0x20];
@@ -3655,7 +3655,7 @@ struct mlx5_ifc_stc_ste_param_vport_bits {
 	u8 eswitch_owner_vhca_id[0x10];
 	u8 vport_number[0x10];
 	u8 eswitch_owner_vhca_id_valid[0x1];
-	u8 reserved_at_21[0x59];
+	u8 reserved_at_21[0x5f];
 };
 
 union mlx5_ifc_stc_param_bits {
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 03/16] net/mlx5/hws: fix wrong comment in mlx5dr send
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
  2024-05-06 11:44   ` [v2 02/16] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 04/16] net/mlx5/hws: remove unused capabilities and fields Itamar Gozlan
                     ` (12 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Mark Bloch,
	Alex Vesker
  Cc: dev, stable

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Remove comment that documents parameter that doesn't exist.

Fixes: 3eb748869d2d ("net/mlx5/hws: add send layer")
Cc: stable@dpdk.org

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_send.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_send.h b/drivers/net/mlx5/hws/mlx5dr_send.h
index c4eaea52ab..0c89faa8a7 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.h
+++ b/drivers/net/mlx5/hws/mlx5dr_send.h
@@ -203,8 +203,6 @@ struct mlx5dr_send_ste_attr {
  *   value to write in CPU endian format.
  * @param addr
  *   Address to write to.
- * @param lock
- *   Address of the lock to use for that UAR access.
  */
 static __rte_always_inline void
 mlx5dr_uar_write64_relaxed(uint64_t val, void *addr)
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 04/16] net/mlx5/hws: remove unused capabilities and fields
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
  2024-05-06 11:44   ` [v2 02/16] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
  2024-05-06 11:44   ` [v2 03/16] net/mlx5/hws: fix wrong comment in mlx5dr send Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 05/16] net/mlx5/hws: negating rte errno on rule creation failure Itamar Gozlan
                     ` (11 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

The following caps were never in use:
 - wire_regc
 - metadata_c
 - metadata_c_mask
Also send ring's reg_addr field wasn't in use.

Removing these caps and fields from structs and removing
the code that queried them.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c  | 11 ++---------
 drivers/net/mlx5/hws/mlx5dr_cmd.h  |  3 ---
 drivers/net/mlx5/hws/mlx5dr_send.c |  1 -
 drivers/net/mlx5/hws/mlx5dr_send.h |  1 -
 4 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index 0e0cc479a6..666d678b42 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -1344,12 +1344,10 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 	strlcpy(caps->fw_ver, attr_ex.orig_attr.fw_ver, sizeof(caps->fw_ver));
 
 	port_info = flow_hw_get_wire_port(ctx);
-	if (port_info) {
-		caps->wire_regc = port_info->regc_value;
+	if (port_info)
 		caps->wire_regc_mask = port_info->regc_mask;
-	} else {
+	else
 		DR_LOG(INFO, "Failed to query wire port regc value");
-	}
 
 	return ret;
 }
@@ -1374,10 +1372,5 @@ int mlx5dr_cmd_query_ib_port(struct ibv_context *ctx,
 	vport_caps->vport_num = port_info.vport_id;
 	vport_caps->esw_owner_vhca_id = port_info.esw_owner_vhca_id;
 
-	if (port_info.query_flags & MLX5_PORT_QUERY_REG_C0) {
-		vport_caps->metadata_c = port_info.vport_meta_tag;
-		vport_caps->metadata_c_mask = port_info.vport_meta_mask;
-	}
-
 	return 0;
 }
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index 9d385fc57f..ea5d346d8e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -194,8 +194,6 @@ struct mlx5dr_cmd_query_ft_caps {
 struct mlx5dr_cmd_query_vport_caps {
 	uint16_t vport_num;
 	uint16_t esw_owner_vhca_id;
-	uint32_t metadata_c;
-	uint32_t metadata_c_mask;
 };
 
 struct mlx5dr_cmd_generate_wqe_attr {
@@ -207,7 +205,6 @@ struct mlx5dr_cmd_generate_wqe_attr {
 };
 
 struct mlx5dr_cmd_query_caps {
-	uint32_t wire_regc;
 	uint32_t wire_regc_mask;
 	uint32_t flex_protocols;
 	uint8_t wqe_based_update;
diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index f749401c6f..d58fdb108f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -729,7 +729,6 @@ static int mlx5dr_send_ring_open_sq(struct mlx5dr_context *ctx,
 	buf_sz = queue->num_entries * MAX_WQES_PER_RULE;
 	sq_log_buf_sz = log2above(buf_sz);
 	sq_buf_sz = 1 << (sq_log_buf_sz + log2above(MLX5_SEND_WQE_BB));
-	sq->reg_addr = queue->uar->reg_addr;
 
 	page_size = sysconf(_SC_PAGESIZE);
 	buf_aligned = align(sq_buf_sz, page_size);
diff --git a/drivers/net/mlx5/hws/mlx5dr_send.h b/drivers/net/mlx5/hws/mlx5dr_send.h
index 0c89faa8a7..48593adbed 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.h
+++ b/drivers/net/mlx5/hws/mlx5dr_send.h
@@ -114,7 +114,6 @@ struct mlx5dr_send_ring_sq {
 	char *buf;
 	uint32_t sqn;
 	__be32 *db;
-	void *reg_addr;
 	uint16_t cur_post;
 	uint16_t buf_mask;
 	struct mlx5dr_send_ring_priv *wr_priv;
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 05/16] net/mlx5/hws: negating rte errno on rule creation failure
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (2 preceding siblings ...)
  2024-05-06 11:44   ` [v2 04/16] net/mlx5/hws: remove unused capabilities and fields Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 06/16] net/mlx5/hws: simplify send queues close code Itamar Gozlan
                     ` (10 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

mlx5dr_rule_create returns -ret, so internal functions should return
rte_errno on failure. Fix return values of the function that creates
rule in root table.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index f14e1e6ecd..7bcf2de55f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -733,7 +733,7 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule,
 free_attr:
 	simple_free(attr);
 
-	return -rte_errno;
+	return rte_errno;
 }
 
 static int mlx5dr_rule_destroy_root(struct mlx5dr_rule *rule,
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 06/16] net/mlx5/hws: simplify send queues close code
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (3 preceding siblings ...)
  2024-05-06 11:44   ` [v2 05/16] net/mlx5/hws: negating rte errno on rule creation failure Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 07/16] net/mlx5/hws: fix error flow in mlx5dr context open Itamar Gozlan
                     ` (9 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Small simplification to the send_queues_close code

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_send.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index d58fdb108f..d61862f074 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -970,13 +970,8 @@ int mlx5dr_send_queue_open(struct mlx5dr_context *ctx,
 
 static void __mlx5dr_send_queues_close(struct mlx5dr_context *ctx, uint16_t queues)
 {
-	struct mlx5dr_send_engine *queue;
-
-	while (queues--) {
-		queue = &ctx->send_queue[queues];
-
-		mlx5dr_send_queue_close(queue);
-	}
+	while (queues--)
+		mlx5dr_send_queue_close(&ctx->send_queue[queues]);
 }
 
 void mlx5dr_send_queues_close(struct mlx5dr_context *ctx)
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 07/16] net/mlx5/hws: fix error flow in mlx5dr context open
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (4 preceding siblings ...)
  2024-05-06 11:44   ` [v2 06/16] net/mlx5/hws: simplify send queues close code Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 08/16] net/mlx5/hws: fix code analysis error in passing 0 enum val Itamar Gozlan
                     ` (8 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Alex Vesker
  Cc: dev, stable

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Add missing spinlock destruction in error flow.

Fixes: b0290e56dd08 ("net/mlx5/hws: add context object")
Cc: stable@dpdk.org

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_context.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_context.c b/drivers/net/mlx5/hws/mlx5dr_context.c
index 15d53c578a..7f120b3b1b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_context.c
+++ b/drivers/net/mlx5/hws/mlx5dr_context.c
@@ -263,6 +263,7 @@ struct mlx5dr_context *mlx5dr_context_open(struct ibv_context *ibv_ctx,
 free_caps:
 	simple_free(ctx->caps);
 free_ctx:
+	pthread_spin_destroy(&ctx->ctrl_lock);
 	simple_free(ctx);
 	return NULL;
 }
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 08/16] net/mlx5/hws: fix code analysis error in passing 0 enum val
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (5 preceding siblings ...)
  2024-05-06 11:44   ` [v2 07/16] net/mlx5/hws: fix error flow in mlx5dr context open Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 09/16] net/mlx5/hws: simplify code for updating CQ doorbell record Itamar Gozlan
                     ` (7 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev, stable

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Instead of passing 0 as an enum parameter, define flag NONE.
This resolves the following code analysis error: "enumerated
type mixed with another type".
This value is currently used in tests only, and will later
be used in backward-compatible steering API.

Fixes: 5cadd74fbc08 ("net/mlx5: add HW steering low-level abstract stub")
Cc: stable@dpdk.org

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 80e118a980..d2c426e679 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -82,6 +82,7 @@ enum mlx5dr_action_aso_ct_flags {
 };
 
 enum mlx5dr_match_template_flags {
+	MLX5DR_MATCH_TEMPLATE_FLAG_NONE = 0,
 	/* Allow relaxed matching by skipping derived dependent match fields. */
 	MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH = 1,
 };
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 09/16] net/mlx5/hws: simplify code for updating CQ doorbell record
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (6 preceding siblings ...)
  2024-05-06 11:44   ` [v2 08/16] net/mlx5/hws: fix code analysis error in passing 0 enum val Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 10/16] net/mlx5/hws: drop at attach number of actions Itamar Gozlan
                     ` (6 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Simplify the code that does CQ poll - have DB record
update as part of CQ polling.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_send.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_send.c b/drivers/net/mlx5/hws/mlx5dr_send.c
index d61862f074..2942668e76 100644
--- a/drivers/net/mlx5/hws/mlx5dr_send.c
+++ b/drivers/net/mlx5/hws/mlx5dr_send.c
@@ -594,7 +594,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue,
 	    cqe_owner != sw_own)
 		return;
 
-	if (unlikely(mlx5dv_get_cqe_opcode(cqe) != MLX5_CQE_REQ))
+	if (unlikely(cqe_opcode != MLX5_CQE_REQ))
 		queue->err = true;
 
 	rte_io_rmb();
@@ -611,6 +611,7 @@ static void mlx5dr_send_engine_poll_cq(struct mlx5dr_send_engine *queue,
 	cq->poll_wqe = (wqe_cnt + priv->num_wqebbs) & sq->buf_mask;
 	mlx5dr_send_engine_update(queue, cqe, priv, res, i, res_nb, wqe_cnt);
 	cq->cons_index++;
+	*cq->db = htobe32(cq->cons_index & 0xffffff);
 }
 
 static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue,
@@ -620,13 +621,9 @@ static void mlx5dr_send_engine_poll_cqs(struct mlx5dr_send_engine *queue,
 {
 	int j;
 
-	for (j = 0; j < MLX5DR_NUM_SEND_RINGS; j++) {
+	for (j = 0; j < MLX5DR_NUM_SEND_RINGS; j++)
 		mlx5dr_send_engine_poll_cq(queue, &queue->send_ring[j],
 					   res, polled, res_nb);
-
-		*queue->send_ring[j].send_cq.db =
-			htobe32(queue->send_ring[j].send_cq.cons_index & 0xffffff);
-	}
 }
 
 static void mlx5dr_send_engine_poll_list(struct mlx5dr_send_engine *queue,
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 10/16] net/mlx5/hws: drop at attach number of actions
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (7 preceding siblings ...)
  2024-05-06 11:44   ` [v2 09/16] net/mlx5/hws: simplify code for updating CQ doorbell record Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 11/16] net/mlx5/hws: extending tag saving for match and jumbo Itamar Gozlan
                     ` (5 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev, Alex Vesker

From: Alex Vesker <valex@nvidia.com>

Requesting the user for number of action resources is
not defined well enough, instead the user should provide
an initial action template which should contain the
future attached action templates.

Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 1213e7f0ad..78d525e578 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -785,6 +785,13 @@ static int mlx5dr_matcher_bind_at(struct mlx5dr_matcher *matcher)
 	if (matcher->flags & MLX5DR_MATCHER_FLAGS_COLLISION)
 		return 0;
 
+	if (matcher->attr.max_num_of_at_attach &&
+	    mlx5dr_matcher_req_fw_wqe(matcher)) {
+		DR_LOG(ERR, "FW extended matcher doesn't support additional at");
+		rte_errno = ENOTSUP;
+		return rte_errno;
+	}
+
 	for (i = 0; i < matcher->num_of_at; i++) {
 		struct mlx5dr_action_template *at = &matcher->at[i];
 
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 11/16] net/mlx5/hws: extending tag saving for match and jumbo
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (8 preceding siblings ...)
  2024-05-06 11:44   ` [v2 10/16] net/mlx5/hws: drop at attach number of actions Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 12/16] net/mlx5/hws: dw order optimization code enhancement Itamar Gozlan
                     ` (4 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Alex Vesker
  Cc: dev, stable

From: Erez Shitrit <erezsh@nvidia.com>

Save the exact tag when matching over jumbo masking.

Fixes: 348cdeec6472 ("net/mlx5/hws: add FW WQE rule creation logic")
Cc: stable@dpdk.org

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 7bcf2de55f..5b74e6d85f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -195,8 +195,13 @@ mlx5dr_rule_save_delete_info(struct mlx5dr_rule *rule,
 		rule->tag_ptr = simple_calloc(2, sizeof(*rule->tag_ptr));
 		assert(rule->tag_ptr);
 
-		src_tag = (uint8_t *)ste_attr->wqe_data->tag;
-		memcpy(rule->tag_ptr[0].match, src_tag, MLX5DR_MATCH_TAG_SZ);
+		if (is_jumbo)
+			memcpy(rule->tag_ptr[0].jumbo, ste_attr->wqe_data->action,
+			       MLX5DR_JUMBO_TAG_SZ);
+		else
+			memcpy(rule->tag_ptr[0].match, ste_attr->wqe_data->tag,
+			       MLX5DR_MATCH_TAG_SZ);
+
 		rule->tag_ptr[1].reserved[0] = ste_attr->send_attr.match_definer_id;
 
 		/* Save range definer id and tag for delete */
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 12/16] net/mlx5/hws: dw order optimization code enhancement
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (9 preceding siblings ...)
  2024-05-06 11:44   ` [v2 11/16] net/mlx5/hws: extending tag saving for match and jumbo Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 13/16] net/mlx5/hws: set default miss when replacing table Itamar Gozlan
                     ` (3 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev, stable

Improving code readability by following code styles such as mlx5dr prefix
and extracting a support check to an external function call.
Also, reducing unneeded static memory allocation using a bounded size
macro.

Fixes: 88ff41793e7a ("net/mlx5/hws: reorder STE fields to improve hash")
Cc: stable@dpdk.org

Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 39 ++++++++++++++-------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 81d0e0e6df..cffbb7b589 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -31,6 +31,8 @@
 
 #define MLX5DR_DEFINER_QUOTA_BLOCK 0
 #define MLX5DR_DEFINER_QUOTA_PASS  2
+#define MLX5DR_DEFINER_MAX_ROW_LOG 32
+#define MLX5DR_DEFINER_HL_OPT_MAX 2
 
 /* Setter function based on bit offset and mask, for 32bit DW*/
 #define _DR_SET_32(p, v, byte_off, bit_off, mask) \
@@ -104,21 +106,13 @@
 	__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
 	__mlx5_mask(typ, fld))
 
-#define MAX_ROW_LOG 31
-
-enum header_layout {
-	MLX5DR_HL_IPV4_SRC = 64,
-	MLX5DR_HL_IPV4_DST = 65,
-	MAX_HL_PRIO,
-};
-
 /* Each row (i) indicates a different matcher size, and each column (j)
  * represents {DW5, DW4, DW3, DW2, DW1, DW0}.
- * For values 0,..,2^i, and j (DW) 0,..,5: optimal_dist_dw[i][j] is 1 if the
+ * For values 0,..,2^i, and j (DW) 0,..,5: mlx5dr_optimal_dist_dw[i][j] is 1 if the
  * number of different hash results on these values equals 2^i, meaning this
  * DW hash distribution is complete.
  */
-int optimal_dist_dw[MAX_ROW_LOG][DW_SELECTORS_MATCH] = {
+int mlx5dr_optimal_dist_dw[MLX5DR_DEFINER_MAX_ROW_LOG][DW_SELECTORS_MATCH] = {
 	{1, 1, 1, 1, 1, 1}, {0, 1, 1, 0, 1, 0}, {0, 1, 1, 0, 1, 0},
 	{1, 0, 1, 0, 1, 0}, {0, 0, 0, 1, 1, 0}, {0, 1, 1, 0, 1, 0},
 	{0, 0, 0, 0, 1, 0}, {0, 1, 1, 0, 1, 0}, {0, 0, 0, 0, 0, 0},
@@ -3471,16 +3465,16 @@ mlx5dr_definer_find_best_range_fit(struct mlx5dr_definer *definer,
 
 static void mlx5dr_definer_optimize_order(struct mlx5dr_definer *definer, int num_log)
 {
-	uint8_t hl_prio[MAX_HL_PRIO - 1] = {MLX5DR_HL_IPV4_SRC,
-					    MLX5DR_HL_IPV4_DST,
-					    MAX_HL_PRIO};
+	uint8_t hl_prio[MLX5DR_DEFINER_HL_OPT_MAX];
 	int dw = 0, i = 0, j;
 	int *dw_flag;
 	uint8_t tmp;
 
-	dw_flag = optimal_dist_dw[num_log];
+	dw_flag = mlx5dr_optimal_dist_dw[num_log];
+	hl_prio[0] = __mlx5_dw_off(definer_hl, ipv4_src_dest_outer.source_address);
+	hl_prio[1] = __mlx5_dw_off(definer_hl, ipv4_src_dest_outer.destination_address);
 
-	while (hl_prio[i] != MAX_HL_PRIO) {
+	while (i < MLX5DR_DEFINER_HL_OPT_MAX) {
 		j = 0;
 		/* Finding a candidate to improve its hash distribution */
 		while (j < DW_SELECTORS_MATCH && (hl_prio[i] != definer->dw_selector[j]))
@@ -3632,6 +3626,16 @@ int mlx5dr_definer_compare(struct mlx5dr_definer *definer_a,
 	return 0;
 }
 
+static int
+mlx5dr_definer_optimize_order_supported(struct mlx5dr_definer *match_definer,
+					struct mlx5dr_matcher *matcher)
+{
+	return !mlx5dr_definer_is_jumbo(match_definer) &&
+	       !mlx5dr_matcher_req_fw_wqe(matcher) &&
+	       !mlx5dr_matcher_is_resizable(matcher) &&
+	       !mlx5dr_matcher_is_insert_by_idx(matcher);
+}
+
 static int
 mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher,
 			   struct mlx5dr_definer *match_definer,
@@ -3693,10 +3697,7 @@ mlx5dr_definer_calc_layout(struct mlx5dr_matcher *matcher,
 		goto free_fc;
 	}
 
-	if (!mlx5dr_definer_is_jumbo(match_definer) &&
-	    !mlx5dr_matcher_req_fw_wqe(matcher) &&
-	    !mlx5dr_matcher_is_resizable(matcher) &&
-	    !mlx5dr_matcher_is_insert_by_idx(matcher))
+	if (mlx5dr_definer_optimize_order_supported(match_definer, matcher))
 		mlx5dr_definer_optimize_order(match_definer, matcher->attr.rule.num_log);
 
 	/* Find the range definer layout for match templates fcrs */
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 13/16] net/mlx5/hws: set default miss when replacing table
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (10 preceding siblings ...)
  2024-05-06 11:44   ` [v2 12/16] net/mlx5/hws: dw order optimization code enhancement Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 14/16] net/mlx5/hws: fix invalid memory access in decapl3 Itamar Gozlan
                     ` (2 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev, stable

Allowing the replacement of a miss table without enforcing
a previous disconnecting. This feature extension allows the
user to change the destination miss table when the system
runs without losing traffic.

Fixes: b81f95ca770d ("net/mlx5/hws: support default miss table")
Cc: stable@dpdk.org

Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_table.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index 55b9b20150..ab73017ade 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -611,8 +611,7 @@ static int mlx5dr_table_set_default_miss_not_valid(struct mlx5dr_table *tbl,
 
 	if (mlx5dr_table_is_root(tbl) ||
 	    (miss_tbl && mlx5dr_table_is_root(miss_tbl)) ||
-	    (miss_tbl && miss_tbl->type != tbl->type) ||
-	    (miss_tbl && tbl->default_miss.miss_tbl)) {
+	    (miss_tbl && miss_tbl->type != tbl->type)) {
 		DR_LOG(ERR, "Invalid arguments");
 		rte_errno = EINVAL;
 		return -rte_errno;
@@ -625,6 +624,7 @@ int mlx5dr_table_set_default_miss(struct mlx5dr_table *tbl,
 				  struct mlx5dr_table *miss_tbl)
 {
 	struct mlx5dr_context *ctx = tbl->ctx;
+	struct mlx5dr_table *old_miss_tbl;
 	int ret;
 
 	ret = mlx5dr_table_set_default_miss_not_valid(tbl, miss_tbl);
@@ -632,15 +632,16 @@ int mlx5dr_table_set_default_miss(struct mlx5dr_table *tbl,
 		return ret;
 
 	pthread_spin_lock(&ctx->ctrl_lock);
-
+	old_miss_tbl = tbl->default_miss.miss_tbl;
 	ret = mlx5dr_table_connect_to_miss_table(tbl, miss_tbl);
 	if (ret)
 		goto out;
 
+	if (old_miss_tbl)
+		LIST_REMOVE(tbl, default_miss.next);
+
 	if (miss_tbl)
 		LIST_INSERT_HEAD(&miss_tbl->default_miss.head, tbl, default_miss.next);
-	else
-		LIST_REMOVE(tbl, default_miss.next);
 
 	pthread_spin_unlock(&ctx->ctrl_lock);
 	return 0;
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 14/16] net/mlx5/hws: fix invalid memory access in decapl3
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (11 preceding siblings ...)
  2024-05-06 11:44   ` [v2 13/16] net/mlx5/hws: set default miss when replacing table Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 15/16] net/mlx5/hws: dump action ste arrays info Itamar Gozlan
  2024-05-06 11:44   ` [v2 16/16] net/mlx5/hws: fix action template only term param dump print Itamar Gozlan
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Alex Vesker
  Cc: dev, stable

From: Alex Vesker <valex@nvidia.com>

In case decapL3 action is created we would access header
data even in case the SHARED flag is not set, this would
lead to an invalid memory access.

Fixes: 3a6c50215c07 ("net/mlx5/hws: support multi-pattern")
Cc: stable@dpdk.org

Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_action.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 084d4d606e..562fb5cbb4 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -1775,7 +1775,9 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_action *action,
 
 	/* Create a full modify header action list in case shared */
 	mlx5dr_action_prepare_decap_l3_actions(hdrs->sz, mh_data, &num_of_actions);
-	mlx5dr_action_prepare_decap_l3_data(hdrs->data, mh_data, num_of_actions);
+
+	if (action->flags & MLX5DR_ACTION_FLAG_SHARED)
+		mlx5dr_action_prepare_decap_l3_data(hdrs->data, mh_data, num_of_actions);
 
 	/* All DecapL3 cases require the same max arg size */
 	arg_obj = mlx5dr_arg_create_modify_header_arg(ctx,
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 15/16] net/mlx5/hws: dump action ste arrays info
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (12 preceding siblings ...)
  2024-05-06 11:44   ` [v2 14/16] net/mlx5/hws: fix invalid memory access in decapl3 Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  2024-05-06 11:44   ` [v2 16/16] net/mlx5/hws: fix action template only term param dump print Itamar Gozlan
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad
  Cc: dev

From: Hamdan Igbaria <hamdani@nvidia.com>

Dump action ste arrays info for resizing matchers.

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_debug.c   | 23 +++++++++++++++++++++++
 drivers/net/mlx5/hws/mlx5dr_debug.h   |  1 +
 drivers/net/mlx5/hws/mlx5dr_matcher.c |  1 +
 drivers/net/mlx5/hws/mlx5dr_matcher.h |  1 +
 4 files changed, 26 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 8f07c7fd66..5ad4ca2da5 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -206,6 +206,7 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 	bool is_shared = mlx5dr_context_shared_gvmi_used(matcher->tbl->ctx);
 	bool is_root = matcher->tbl->level == MLX5DR_ROOT_LEVEL;
 	enum mlx5dr_table_type tbl_type = matcher->tbl->type;
+	struct mlx5dr_matcher_resize_data *resize_data;
 	struct mlx5dr_cmd_ft_query_attr ft_attr = {0};
 	struct mlx5dr_devx_obj *ste_0, *ste_1 = NULL;
 	struct mlx5dr_pool_chunk *ste;
@@ -288,6 +289,28 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 	if (ret)
 		return ret;
 
+	LIST_FOREACH(resize_data, &matcher->resize_data, next) {
+		ste = &resize_data->ste;
+		ste_pool = resize_data->action_ste_pool;
+		if (ste_pool) {
+			ste_0 = mlx5dr_pool_chunk_get_base_devx_obj(ste_pool, ste);
+			if (tbl_type == MLX5DR_TABLE_TYPE_FDB)
+				ste_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(ste_pool, ste);
+		} else {
+			ste_0 = NULL;
+			ste_1 = NULL;
+		}
+		ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d\n",
+			      MLX5DR_DEBUG_RES_TYPE_MATCHER_RESIZABLE_ACTION_ARRAY,
+			      (uint64_t)(uintptr_t)matcher,
+			      resize_data->action_ste_rtc_0 ? resize_data->action_ste_rtc_0->id : 0,
+			      ste_0 ? (int)ste_0->id : -1,
+			      resize_data->action_ste_rtc_1 ? resize_data->action_ste_rtc_1->id : 0,
+			      ste_1 ? (int)ste_1->id : -1);
+		if (ret < 0)
+			return ret;
+	}
+
 	return 0;
 
 out_err:
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.h b/drivers/net/mlx5/hws/mlx5dr_debug.h
index a89a6a0b1d..b69002b5cd 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.h
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.h
@@ -25,6 +25,7 @@ enum mlx5dr_debug_res_type {
 	MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_HASH_DEFINER = 4205,
 	MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_RANGE_DEFINER = 4206,
 	MLX5DR_DEBUG_RES_TYPE_MATCHER_TEMPLATE_COMPARE_MATCH_DEFINER = 4207,
+	MLX5DR_DEBUG_RES_TYPE_MATCHER_RESIZABLE_ACTION_ARRAY = 4208,
 };
 
 static inline uint64_t
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 78d525e578..8f1a202f81 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -724,6 +724,7 @@ mlx5dr_matcher_resize_init(struct mlx5dr_matcher *src_matcher)
 		return rte_errno;
 	}
 
+	resize_data->ste = src_matcher->action_ste.ste;
 	resize_data->stc = src_matcher->action_ste.stc;
 	resize_data->action_ste_rtc_0 = src_matcher->action_ste.rtc_0;
 	resize_data->action_ste_rtc_1 = src_matcher->action_ste.rtc_1;
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.h b/drivers/net/mlx5/hws/mlx5dr_matcher.h
index 6dc3bf4d0d..caff403a38 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.h
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.h
@@ -62,6 +62,7 @@ struct mlx5dr_matcher_action_ste {
 };
 
 struct mlx5dr_matcher_resize_data {
+	struct mlx5dr_pool_chunk ste;
 	struct mlx5dr_pool_chunk stc;
 	struct mlx5dr_devx_obj *action_ste_rtc_0;
 	struct mlx5dr_devx_obj *action_ste_rtc_1;
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [v2 16/16] net/mlx5/hws: fix action template only term param dump print
  2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
                     ` (13 preceding siblings ...)
  2024-05-06 11:44   ` [v2 15/16] net/mlx5/hws: dump action ste arrays info Itamar Gozlan
@ 2024-05-06 11:44   ` Itamar Gozlan
  14 siblings, 0 replies; 33+ messages in thread
From: Itamar Gozlan @ 2024-05-06 11:44 UTC (permalink / raw)
  To: igozlan, erezsh, hamdani, kliteyn, viacheslavo, thomas,
	suanmingm, Dariusz Sosnowski, Ori Kam, Matan Azrad, Alex Vesker
  Cc: dev, stable

From: Hamdan Igbaria <hamdani@nvidia.com>

The debug print of only_term param in the action template
was printed incorrectly.

Fixes: 78580cf4e796 ("net/mlx5/hws: add debug layer")
Cc: stable@dpdk.org

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 5ad4ca2da5..741a725842 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -153,7 +153,7 @@ mlx5dr_debug_dump_matcher_action_template(FILE *f, struct mlx5dr_matcher *matche
 			      MLX5DR_DEBUG_RES_TYPE_MATCHER_ACTION_TEMPLATE,
 			      (uint64_t)(uintptr_t)at,
 			      (uint64_t)(uintptr_t)matcher,
-			      at->only_term ? 0 : 1,
+			      at->only_term,
 			      is_root ? 0 : at->num_of_action_stes,
 			      at->num_actions);
 		if (ret < 0) {
-- 
2.39.3


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2024-05-06 11:46 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 11:42 [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Itamar Gozlan
2024-03-14 11:42 ` [PATCH 02/13] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
2024-03-14 11:42 ` [PATCH 03/13] net/mlx5/hws: fix wrong comment in mlx5dr_send Itamar Gozlan
2024-03-14 11:42 ` [PATCH 04/13] net/mlx5/hws: remove unused capabilities and fields Itamar Gozlan
2024-03-14 11:42 ` [PATCH 05/13] net/mlx5/hws: return -rte_errno on rule creation failure Itamar Gozlan
2024-03-14 11:42 ` [PATCH 06/13] net/mlx5/hws: simplify send_queues_close code Itamar Gozlan
2024-03-14 11:42 ` [PATCH 07/13] net/mlx5/hws: fix error flow in mlx5dr_context_open Itamar Gozlan
2024-03-14 11:42 ` [PATCH 08/13] net/mlx5/hws: fix code analysis error in passing 0 enum val Itamar Gozlan
2024-03-14 11:42 ` [PATCH 09/13] net/mlx5/hws: simplify code for updating CQ doorbell record Itamar Gozlan
2024-03-14 11:42 ` [PATCH 10/13] net/mlx5/hws: fix rule is in resize check Itamar Gozlan
2024-03-14 11:42 ` [PATCH 11/13] net/mlx5/hws: drop at attach number of actions Itamar Gozlan
2024-03-14 11:42 ` [PATCH 12/13] net/mlx5/hws: extending tag saving for match and jumbo Itamar Gozlan
2024-03-14 11:42 ` [PATCH 13/13] net/mlx5/hws: fix port ID for root matcher and rule Itamar Gozlan
2024-03-18 12:56 ` [PATCH 01/13] net/mlx5/hws: move warn into debug level when needed Raslan Darawsheh
2024-03-18 14:48   ` Thomas Monjalon
2024-03-19  7:33     ` Raslan Darawsheh
2024-03-20 16:35       ` Yevgeny Kliteynik
2024-05-06 11:44 ` [v2 01/16] " Itamar Gozlan
2024-05-06 11:44   ` [v2 02/16] common/mlx5: fix error in mlx5 prm structs Itamar Gozlan
2024-05-06 11:44   ` [v2 03/16] net/mlx5/hws: fix wrong comment in mlx5dr send Itamar Gozlan
2024-05-06 11:44   ` [v2 04/16] net/mlx5/hws: remove unused capabilities and fields Itamar Gozlan
2024-05-06 11:44   ` [v2 05/16] net/mlx5/hws: negating rte errno on rule creation failure Itamar Gozlan
2024-05-06 11:44   ` [v2 06/16] net/mlx5/hws: simplify send queues close code Itamar Gozlan
2024-05-06 11:44   ` [v2 07/16] net/mlx5/hws: fix error flow in mlx5dr context open Itamar Gozlan
2024-05-06 11:44   ` [v2 08/16] net/mlx5/hws: fix code analysis error in passing 0 enum val Itamar Gozlan
2024-05-06 11:44   ` [v2 09/16] net/mlx5/hws: simplify code for updating CQ doorbell record Itamar Gozlan
2024-05-06 11:44   ` [v2 10/16] net/mlx5/hws: drop at attach number of actions Itamar Gozlan
2024-05-06 11:44   ` [v2 11/16] net/mlx5/hws: extending tag saving for match and jumbo Itamar Gozlan
2024-05-06 11:44   ` [v2 12/16] net/mlx5/hws: dw order optimization code enhancement Itamar Gozlan
2024-05-06 11:44   ` [v2 13/16] net/mlx5/hws: set default miss when replacing table Itamar Gozlan
2024-05-06 11:44   ` [v2 14/16] net/mlx5/hws: fix invalid memory access in decapl3 Itamar Gozlan
2024-05-06 11:44   ` [v2 15/16] net/mlx5/hws: dump action ste arrays info Itamar Gozlan
2024-05-06 11:44   ` [v2 16/16] net/mlx5/hws: fix action template only term param dump print Itamar Gozlan

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).