[v1,3/8] net/mlx5/hws: add no reparse support

Message ID 20230417092540.2617450-4-rongweil@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series add IPv6 extension push remove |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Rongwei Liu April 17, 2023, 9:25 a.m. UTC
  Allocate two groups of RTC to control hardware reparsing
when flow is updated.
1. Group 1 always reparse the traffic after packet is modified
   by any hardware module. This is the default behavior which is
   the same as before.
2. Group 2 doesn't perform any packets reparsing. This will help
   the complex flow rules.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_cmd.c     |  5 +-
 drivers/net/mlx5/hws/mlx5dr_cmd.h     |  1 +
 drivers/net/mlx5/hws/mlx5dr_debug.c   |  8 +--
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 80 +++++++++++++++++----------
 drivers/net/mlx5/hws/mlx5dr_matcher.h | 12 ++--
 drivers/net/mlx5/hws/mlx5dr_rule.c    | 65 ++++++++++++++++------
 6 files changed, 117 insertions(+), 54 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index 0adcedd9c9..42bf1980db 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -283,7 +283,10 @@  mlx5dr_cmd_rtc_create(struct ibv_context *ctx,
 	MLX5_SET(rtc, attr, ste_table_base_id, rtc_attr->ste_base);
 	MLX5_SET(rtc, attr, ste_table_offset, rtc_attr->ste_offset);
 	MLX5_SET(rtc, attr, miss_flow_table_id, rtc_attr->miss_ft_id);
-	MLX5_SET(rtc, attr, reparse_mode, MLX5_IFC_RTC_REPARSE_ALWAYS);
+	if (rtc_attr->is_reparse)
+		MLX5_SET(rtc, attr, reparse_mode, MLX5_IFC_RTC_REPARSE_ALWAYS);
+	else
+		MLX5_SET(rtc, attr, reparse_mode, MLX5_IFC_RTC_REPARSE_NEVER);
 
 	devx_obj->obj = mlx5_glue->devx_obj_create(ctx, in, sizeof(in), out, sizeof(out));
 	if (!devx_obj->obj) {
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index 3f40c085be..b225171d4c 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -51,6 +51,7 @@  struct mlx5dr_cmd_rtc_create_attr {
 	uint8_t match_definer_1;
 	bool is_frst_jumbo;
 	bool is_scnd_range;
+	uint8_t is_reparse;
 };
 
 struct mlx5dr_cmd_alias_obj_create_attr {
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 6b32ac4ee6..b8049a173d 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -224,9 +224,9 @@  static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 	}
 
 	ret = fprintf(f, ",%d,%d,%d,%d",
-		      matcher->match_ste.rtc_0 ? matcher->match_ste.rtc_0->id : 0,
+		      matcher->match_ste.rtc_0_reparse ? matcher->match_ste.rtc_0_reparse->id : 0,
 		      ste_0 ? (int)ste_0->id : -1,
-		      matcher->match_ste.rtc_1 ? matcher->match_ste.rtc_1->id : 0,
+		      matcher->match_ste.rtc_1_reparse ? matcher->match_ste.rtc_1_reparse->id : 0,
 		      ste_1 ? (int)ste_1->id : -1);
 	if (ret < 0)
 		goto out_err;
@@ -243,9 +243,9 @@  static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 	}
 
 	ret = fprintf(f, ",%d,%d,%d,%d,%d\n",
-		      matcher->action_ste.rtc_0 ? matcher->action_ste.rtc_0->id : 0,
+		      matcher->action_ste.rtc_0_reparse ? matcher->action_ste.rtc_0_reparse->id : 0,
 		      ste_0 ? (int)ste_0->id : -1,
-		      matcher->action_ste.rtc_1 ? matcher->action_ste.rtc_1->id : 0,
+		      matcher->action_ste.rtc_1_reparse ? matcher->action_ste.rtc_1_reparse->id : 0,
 		      ste_1 ? (int)ste_1->id : -1,
 		      is_shared && !is_root ?
 		      matcher->match_ste.aliased_rtc_0->id : 0);
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 1fe7ec1bc3..652d50f73a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -101,7 +101,7 @@  static int mlx5dr_matcher_shared_create_alias_rtc(struct mlx5dr_matcher *matcher
 						ctx->ibv_ctx,
 						ctx->local_ibv_ctx,
 						ctx->caps->shared_vhca_id,
-						matcher->match_ste.rtc_0->id,
+						matcher->match_ste.rtc_0_reparse->id,
 						MLX5_GENERAL_OBJ_TYPE_RTC,
 						&matcher->match_ste.aliased_rtc_0);
 	if (ret) {
@@ -156,7 +156,7 @@  static uint32_t
 mlx5dr_matcher_connect_get_rtc0(struct mlx5dr_matcher *matcher)
 {
 	if (!matcher->match_ste.aliased_rtc_0)
-		return matcher->match_ste.rtc_0->id;
+		return matcher->match_ste.rtc_0_reparse->id;
 	else
 		return matcher->match_ste.aliased_rtc_0->id;
 }
@@ -233,10 +233,10 @@  static int mlx5dr_matcher_connect(struct mlx5dr_matcher *matcher)
 
 	/* Connect to next */
 	if (next) {
-		if (next->match_ste.rtc_0)
-			ft_attr.rtc_id_0 = next->match_ste.rtc_0->id;
-		if (next->match_ste.rtc_1)
-			ft_attr.rtc_id_1 = next->match_ste.rtc_1->id;
+		if (next->match_ste.rtc_0_reparse)
+			ft_attr.rtc_id_0 = next->match_ste.rtc_0_reparse->id;
+		if (next->match_ste.rtc_1_reparse)
+			ft_attr.rtc_id_1 = next->match_ste.rtc_1_reparse->id;
 
 		ret = mlx5dr_cmd_flow_table_modify(matcher->end_ft, &ft_attr);
 		if (ret) {
@@ -248,10 +248,10 @@  static int mlx5dr_matcher_connect(struct mlx5dr_matcher *matcher)
 	/* Connect to previous */
 	ft = prev ? prev->end_ft : tbl->ft;
 
-	if (matcher->match_ste.rtc_0)
-		ft_attr.rtc_id_0 = matcher->match_ste.rtc_0->id;
-	if (matcher->match_ste.rtc_1)
-		ft_attr.rtc_id_1 = matcher->match_ste.rtc_1->id;
+	if (matcher->match_ste.rtc_0_reparse)
+		ft_attr.rtc_id_0 = matcher->match_ste.rtc_0_reparse->id;
+	if (matcher->match_ste.rtc_1_reparse)
+		ft_attr.rtc_id_1 = matcher->match_ste.rtc_1_reparse->id;
 
 	ret = mlx5dr_cmd_flow_table_modify(ft, &ft_attr);
 	if (ret) {
@@ -296,10 +296,10 @@  static int mlx5dr_matcher_disconnect(struct mlx5dr_matcher *matcher)
 
 	if (next) {
 		/* Connect previous end FT to next RTC if exists */
-		if (next->match_ste.rtc_0)
-			ft_attr.rtc_id_0 = next->match_ste.rtc_0->id;
-		if (next->match_ste.rtc_1)
-			ft_attr.rtc_id_1 = next->match_ste.rtc_1->id;
+		if (next->match_ste.rtc_0_reparse)
+			ft_attr.rtc_id_0 = next->match_ste.rtc_0_reparse->id;
+		if (next->match_ste.rtc_1_reparse)
+			ft_attr.rtc_id_1 = next->match_ste.rtc_1_reparse->id;
 	} else {
 		/* Matcher is last, point prev end FT to default miss */
 		mlx5dr_cmd_set_attr_connect_miss_tbl(tbl->ctx,
@@ -470,10 +470,11 @@  static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 	struct mlx5dr_pool_chunk *ste;
 	int ret;
 
+	rtc_attr.is_reparse = true;
 	switch (rtc_type) {
 	case DR_MATCHER_RTC_TYPE_MATCH:
-		rtc_0 = &matcher->match_ste.rtc_0;
-		rtc_1 = &matcher->match_ste.rtc_1;
+		rtc_0 = &matcher->match_ste.rtc_0_reparse;
+		rtc_1 = &matcher->match_ste.rtc_1_reparse;
 		ste_pool = matcher->match_ste.pool;
 		ste = &matcher->match_ste.ste;
 		ste->order = attr->table.sz_col_log + attr->table.sz_row_log;
@@ -537,8 +538,8 @@  static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 		break;
 
 	case DR_MATCHER_RTC_TYPE_STE_ARRAY:
-		rtc_0 = &matcher->action_ste.rtc_0;
-		rtc_1 = &matcher->action_ste.rtc_1;
+		rtc_0 = &matcher->action_ste.rtc_0_reparse;
+		rtc_1 = &matcher->action_ste.rtc_1_reparse;
 		ste_pool = matcher->action_ste.pool;
 		ste = &matcher->action_ste.ste;
 		ste->order = rte_log2_u32(matcher->action_ste.max_stes) +
@@ -558,6 +559,7 @@  static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 		return rte_errno;
 	}
 
+rertc:
 	devx_obj = mlx5dr_pool_chunk_get_base_devx_obj(ste_pool, ste);
 
 	rtc_attr.pd = ctx->pd_num;
@@ -574,8 +576,8 @@  static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 
 	*rtc_0 = mlx5dr_cmd_rtc_create(ctx->ibv_ctx, &rtc_attr);
 	if (!*rtc_0) {
-		DR_LOG(ERR, "Failed to create matcher RTC of type %s",
-		       mlx5dr_matcher_rtc_type_to_str(rtc_type));
+		DR_LOG(ERR, "Failed to create matcher RTC of type %s, reparse %u",
+		       mlx5dr_matcher_rtc_type_to_str(rtc_type), rtc_attr.is_reparse);
 		goto free_ste;
 	}
 
@@ -590,12 +592,25 @@  static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 
 		*rtc_1 = mlx5dr_cmd_rtc_create(ctx->ibv_ctx, &rtc_attr);
 		if (!*rtc_1) {
-			DR_LOG(ERR, "Failed to create peer matcher RTC of type %s",
-			       mlx5dr_matcher_rtc_type_to_str(rtc_type));
+			DR_LOG(ERR, "Failed to create peer matcher RTC of type %s, reparse %u",
+			       mlx5dr_matcher_rtc_type_to_str(rtc_type), rtc_attr.is_reparse);
 			goto destroy_rtc_0;
 		}
 	}
 
+	/* RTC is created in reparse then no_reparse order and fw wqe. */
+	if (rtc_attr.is_reparse && !mlx5dr_matcher_req_fw_wqe(matcher)) {
+		rtc_attr.is_reparse = false;
+		if (rtc_type == DR_MATCHER_RTC_TYPE_MATCH) {
+			rtc_0 = &matcher->match_ste.rtc_0_no_reparse;
+			rtc_1 = &matcher->match_ste.rtc_1_no_reparse;
+		} else {
+			rtc_0 = &matcher->action_ste.rtc_0_no_reparse;
+			rtc_1 = &matcher->action_ste.rtc_1_no_reparse;
+		}
+		goto rertc;
+	}
+
 	return 0;
 
 destroy_rtc_0:
@@ -609,21 +624,25 @@  static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 static void mlx5dr_matcher_destroy_rtc(struct mlx5dr_matcher *matcher,
 				       enum mlx5dr_matcher_rtc_type rtc_type)
 {
+	struct mlx5dr_devx_obj *rtc_0, *rtc_1, *rtc_2, *rtc_3;
 	struct mlx5dr_table *tbl = matcher->tbl;
-	struct mlx5dr_devx_obj *rtc_0, *rtc_1;
 	struct mlx5dr_pool_chunk *ste;
 	struct mlx5dr_pool *ste_pool;
 
 	switch (rtc_type) {
 	case DR_MATCHER_RTC_TYPE_MATCH:
-		rtc_0 = matcher->match_ste.rtc_0;
-		rtc_1 = matcher->match_ste.rtc_1;
+		rtc_0 = matcher->match_ste.rtc_0_reparse;
+		rtc_1 = matcher->match_ste.rtc_1_reparse;
+		rtc_2 = matcher->match_ste.rtc_0_no_reparse;
+		rtc_3 = matcher->match_ste.rtc_1_no_reparse;
 		ste_pool = matcher->match_ste.pool;
 		ste = &matcher->match_ste.ste;
 		break;
 	case DR_MATCHER_RTC_TYPE_STE_ARRAY:
-		rtc_0 = matcher->action_ste.rtc_0;
-		rtc_1 = matcher->action_ste.rtc_1;
+		rtc_0 = matcher->action_ste.rtc_0_reparse;
+		rtc_1 = matcher->action_ste.rtc_1_reparse;
+		rtc_2 = matcher->action_ste.rtc_0_no_reparse;
+		rtc_3 = matcher->action_ste.rtc_1_no_reparse;
 		ste_pool = matcher->action_ste.pool;
 		ste = &matcher->action_ste.ste;
 		break;
@@ -631,10 +650,15 @@  static void mlx5dr_matcher_destroy_rtc(struct mlx5dr_matcher *matcher,
 		return;
 	}
 
-	if (tbl->type == MLX5DR_TABLE_TYPE_FDB)
+	if (tbl->type == MLX5DR_TABLE_TYPE_FDB) {
 		mlx5dr_cmd_destroy_obj(rtc_1);
+		if (rtc_3)
+			mlx5dr_cmd_destroy_obj(rtc_3);
+	}
 
 	mlx5dr_cmd_destroy_obj(rtc_0);
+	if (rtc_2)
+		mlx5dr_cmd_destroy_obj(rtc_2);
 	if (rtc_type == DR_MATCHER_RTC_TYPE_MATCH)
 		mlx5dr_pool_chunk_free(ste_pool, ste);
 }
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.h b/drivers/net/mlx5/hws/mlx5dr_matcher.h
index 4759068ab4..02fd283cd1 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.h
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.h
@@ -43,8 +43,10 @@  struct mlx5dr_match_template {
 
 struct mlx5dr_matcher_match_ste {
 	struct mlx5dr_pool_chunk ste;
-	struct mlx5dr_devx_obj *rtc_0;
-	struct mlx5dr_devx_obj *rtc_1;
+	struct mlx5dr_devx_obj *rtc_0_reparse;
+	struct mlx5dr_devx_obj *rtc_1_reparse;
+	struct mlx5dr_devx_obj *rtc_0_no_reparse;
+	struct mlx5dr_devx_obj *rtc_1_no_reparse;
 	struct mlx5dr_pool *pool;
 	/* Currently not support FDB aliased */
 	struct mlx5dr_devx_obj *aliased_rtc_0;
@@ -53,8 +55,10 @@  struct mlx5dr_matcher_match_ste {
 struct mlx5dr_matcher_action_ste {
 	struct mlx5dr_pool_chunk ste;
 	struct mlx5dr_pool_chunk stc;
-	struct mlx5dr_devx_obj *rtc_0;
-	struct mlx5dr_devx_obj *rtc_1;
+	struct mlx5dr_devx_obj *rtc_0_reparse;
+	struct mlx5dr_devx_obj *rtc_1_reparse;
+	struct mlx5dr_devx_obj *rtc_0_no_reparse;
+	struct mlx5dr_devx_obj *rtc_1_no_reparse;
 	struct mlx5dr_pool *pool;
 	uint8_t max_stes;
 };
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 2418ca0b26..70c6c08741 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -40,11 +40,35 @@  static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher,
 	}
 }
 
+static void mlxdr_rule_set_wqe_rtc_id(struct mlx5dr_send_ring_dep_wqe *wqe,
+				      struct mlx5dr_matcher *matcher,
+				      bool reparse, bool mirror)
+{
+	if (!mirror && !reparse) {
+		wqe->rtc_0 = matcher->match_ste.rtc_0_no_reparse->id;
+		wqe->retry_rtc_0 = matcher->col_matcher ?
+			matcher->col_matcher->match_ste.rtc_0_no_reparse->id : 0;
+	} else if (!mirror && reparse) {
+		wqe->rtc_0 = matcher->match_ste.rtc_0_reparse->id;
+		wqe->retry_rtc_0 = matcher->col_matcher ?
+			matcher->col_matcher->match_ste.rtc_0_reparse->id : 0;
+	} else if (mirror && reparse) {
+		wqe->rtc_1 = matcher->match_ste.rtc_1_reparse->id;
+		wqe->retry_rtc_1 = matcher->col_matcher ?
+			matcher->col_matcher->match_ste.rtc_1_reparse->id : 0;
+	} else if (mirror && !reparse) {
+		wqe->rtc_1 = matcher->match_ste.rtc_1_no_reparse->id;
+		wqe->retry_rtc_1 = matcher->col_matcher ?
+			matcher->col_matcher->match_ste.rtc_1_no_reparse->id : 0;
+	}
+}
+
 static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe,
 				     struct mlx5dr_rule *rule,
 				     const struct rte_flow_item *items,
 				     struct mlx5dr_match_template *mt,
-				     void *user_data)
+				     void *user_data,
+				     bool reparse)
 {
 	struct mlx5dr_matcher *matcher = rule->matcher;
 	struct mlx5dr_table *tbl = matcher->tbl;
@@ -56,9 +80,7 @@  static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe,
 	switch (tbl->type) {
 	case MLX5DR_TABLE_TYPE_NIC_RX:
 	case MLX5DR_TABLE_TYPE_NIC_TX:
-		dep_wqe->rtc_0 = matcher->match_ste.rtc_0->id;
-		dep_wqe->retry_rtc_0 = matcher->col_matcher ?
-				       matcher->col_matcher->match_ste.rtc_0->id : 0;
+		mlxdr_rule_set_wqe_rtc_id(dep_wqe, matcher, reparse, false);
 		dep_wqe->rtc_1 = 0;
 		dep_wqe->retry_rtc_1 = 0;
 		break;
@@ -67,18 +89,14 @@  static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe,
 		mlx5dr_rule_skip(matcher, mt, items, &skip_rx, &skip_tx);
 
 		if (!skip_rx) {
-			dep_wqe->rtc_0 = matcher->match_ste.rtc_0->id;
-			dep_wqe->retry_rtc_0 = matcher->col_matcher ?
-					       matcher->col_matcher->match_ste.rtc_0->id : 0;
+			mlxdr_rule_set_wqe_rtc_id(dep_wqe, matcher, reparse, false);
 		} else {
 			dep_wqe->rtc_0 = 0;
 			dep_wqe->retry_rtc_0 = 0;
 		}
 
 		if (!skip_tx) {
-			dep_wqe->rtc_1 = matcher->match_ste.rtc_1->id;
-			dep_wqe->retry_rtc_1 = matcher->col_matcher ?
-					       matcher->col_matcher->match_ste.rtc_1->id : 0;
+			mlxdr_rule_set_wqe_rtc_id(dep_wqe, matcher, reparse, true);
 		} else {
 			dep_wqe->rtc_1 = 0;
 			dep_wqe->retry_rtc_1 = 0;
@@ -265,8 +283,9 @@  static int mlx5dr_rule_create_hws_fw_wqe(struct mlx5dr_rule *rule,
 	}
 
 	mlx5dr_rule_create_init(rule, &ste_attr, &apply);
-	mlx5dr_rule_init_dep_wqe(&match_wqe, rule, items, mt, attr->user_data);
-	mlx5dr_rule_init_dep_wqe(&range_wqe, rule, items, mt, attr->user_data);
+	/* FW WQE doesn't look on rtc reparse, use default REPARSE_ALWAYS. */
+	mlx5dr_rule_init_dep_wqe(&match_wqe, rule, items, mt, attr->user_data, true);
+	mlx5dr_rule_init_dep_wqe(&range_wqe, rule, items, mt, attr->user_data, true);
 
 	ste_attr.direct_index = 0;
 	ste_attr.rtc_0 = match_wqe.rtc_0;
@@ -348,6 +367,7 @@  static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 	struct mlx5dr_actions_apply_data apply;
 	struct mlx5dr_send_engine *queue;
 	uint8_t total_stes, action_stes;
+	bool matcher_reparse;
 	int i, ret;
 
 	/* Insert rule using FW WQE if cannot use GTA WQE */
@@ -368,7 +388,9 @@  static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 	 * dep_wqe buffers (ctrl, data) are also reused for all STE writes.
 	 */
 	dep_wqe = mlx5dr_send_add_new_dep_wqe(queue);
-	mlx5dr_rule_init_dep_wqe(dep_wqe, rule, items, mt, attr->user_data);
+	/* Jumbo matcher reparse is off. */
+	matcher_reparse = !is_jumbo && (at->setters[1].flags & ASF_REPARSE);
+	mlx5dr_rule_init_dep_wqe(dep_wqe, rule, items, mt, attr->user_data, matcher_reparse);
 
 	ste_attr.wqe_ctrl = &dep_wqe->wqe_ctrl;
 	ste_attr.wqe_data = &dep_wqe->wqe_data;
@@ -389,9 +411,6 @@  static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 			mlx5dr_send_abort_new_dep_wqe(queue);
 			return ret;
 		}
-		/* Skip RX/TX based on the dep_wqe init */
-		ste_attr.rtc_0 = dep_wqe->rtc_0 ? matcher->action_ste.rtc_0->id : 0;
-		ste_attr.rtc_1 = dep_wqe->rtc_1 ? matcher->action_ste.rtc_1->id : 0;
 		/* Action STEs are written to a specific index last to first */
 		ste_attr.direct_index = rule->action_ste_idx + action_stes;
 		apply.next_direct_idx = ste_attr.direct_index;
@@ -400,7 +419,7 @@  static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 	}
 
 	for (i = total_stes; i-- > 0;) {
-		mlx5dr_action_apply_setter(&apply, setter--, !i && is_jumbo);
+		mlx5dr_action_apply_setter(&apply, setter, !i && is_jumbo);
 
 		if (i == 0) {
 			/* Handle last match STE.
@@ -431,9 +450,21 @@  static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 			ste_attr.direct_index = mlx5dr_matcher_is_insert_by_idx(matcher) ?
 						attr->rule_idx : 0;
 		} else {
+			if (setter->flags & ASF_REPARSE) {
+				ste_attr.rtc_0 = dep_wqe->rtc_0 ?
+					matcher->action_ste.rtc_0_reparse->id : 0;
+				ste_attr.rtc_1 = dep_wqe->rtc_1 ?
+					matcher->action_ste.rtc_1_reparse->id : 0;
+			} else {
+				ste_attr.rtc_0 = dep_wqe->rtc_0 ?
+					matcher->action_ste.rtc_0_no_reparse->id : 0;
+				ste_attr.rtc_1 = dep_wqe->rtc_1 ?
+					matcher->action_ste.rtc_1_no_reparse->id : 0;
+			}
 			apply.next_direct_idx = --ste_attr.direct_index;
 		}
 
+		setter--;
 		mlx5dr_send_ste(queue, &ste_attr);
 	}