Skip to contentSkip to conversation

net/mlx5/hws: remove uneeded new line for DR_LOG

PATCH Superseded Itamar Gozlan 2 participants 21 messages Jun 29, 2023 – Jul 6, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 net/mlx5/hws: remove uneeded new line for DR_LOG

From: Alex Vesker <[email protected]>

In some places an extra new line was added, remove to have clean prints.

---
 drivers/net/mlx5/hws/mlx5dr_action.c  | 30 +++++++++++++--------------
 drivers/net/mlx5/hws/mlx5dr_cmd.c     |  2 +-
 drivers/net/mlx5/hws/mlx5dr_definer.c |  4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c |  4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +15 -15
index 01d30b8442..e2db85940c 100644
@@ -112,7 +112,7 @@ static int mlx5dr_action_get_shared_stc_nic(struct mlx5dr_context *ctx,
 		stc_attr.remove_words.num_of_words = MLX5DR_ACTION_HDR_LEN_L2_VLAN;
 		break;
 	default:
-		DR_LOG(ERR, "No such type : stc_type\n");
+		DR_LOG(ERR, "No such type : stc_type");
 		assert(false);
 		rte_errno = EINVAL;
 		goto unlock_and_out;
@@ -469,7 +469,7 @@ static uint32_t mlx5dr_action_get_mh_stc_type(__be64 pattern)
 		return MLX5_IFC_STC_ACTION_TYPE_COPY;
 	default:
 		assert(false);
-		DR_LOG(ERR, "Unsupported action type: 0x%x\n", action_type);
+		DR_LOG(ERR, "Unsupported action type: 0x%x", action_type);
 		rte_errno = ENOTSUP;
 		return MLX5_IFC_STC_ACTION_TYPE_NOP;
 	}
@@ -1017,7 +1017,7 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_cmd_query_ib_port(ctx->ibv_ctx, &vport_caps, ib_port_num);
 	if (ret) {
-		DR_LOG(ERR, "Failed querying port %d\n", ib_port_num);
+		DR_LOG(ERR, "Failed querying port %d", ib_port_num);
 		return ret;
 	}
 	action->vport.vport_num = vport_caps.vport_num;
@@ -1025,7 +1025,7 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for port %d\n", ib_port_num);
+		DR_LOG(ERR, "Failed creating stc for port %d", ib_port_num);
 		return ret;
 	}
 
@@ -1041,7 +1041,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
 	int ret;
 
 	if (!(flags & MLX5DR_ACTION_FLAG_HWS_FDB)) {
-		DR_LOG(ERR, "Vport action is supported for FDB only\n");
+		DR_LOG(ERR, "Vport action is supported for FDB only");
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -1052,7 +1052,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_dest_vport_hws(ctx, action, ib_port_num);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create vport action HWS\n");
+		DR_LOG(ERR, "Failed to create vport action HWS");
 		goto free_action;
 	}
 
@@ -1081,7 +1081,7 @@ mlx5dr_action_create_push_vlan(struct mlx5dr_context *ctx, uint32_t flags)
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for push vlan\n");
+		DR_LOG(ERR, "Failed creating stc for push vlan");
 		goto free_action;
 	}
 
@@ -1115,7 +1115,7 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags)
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for pop vlan\n");
+		DR_LOG(ERR, "Failed creating stc for pop vlan");
 		goto free_shared;
 	}
 
@@ -1418,7 +1418,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_context *ctx,
 
 	if (data_sz != MLX5DR_ACTION_HDR_LEN_L2 &&
 	    data_sz != MLX5DR_ACTION_HDR_LEN_L2_W_VLAN) {
-		DR_LOG(ERR, "Data size is not supported for decap-l3\n");
+		DR_LOG(ERR, "Data size is not supported for decap-l3");
 		rte_errno = EINVAL;
 		return rte_errno;
 	}
@@ -1430,7 +1430,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_context *ctx,
 	ret = mlx5dr_pat_arg_create_modify_header(ctx, action, mh_data_size,
 						  (__be64 *)mh_data, bulk_size);
 	if (ret) {
-		DR_LOG(ERR, "Failed allocating modify-header for decap-l3\n");
+		DR_LOG(ERR, "Failed allocating modify-header for decap-l3");
 		return ret;
 	}
 
@@ -1528,7 +1528,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
 
 	if (!mlx5dr_action_is_hws_flags(flags) ||
 	    ((flags & MLX5DR_ACTION_FLAG_SHARED) && log_bulk_size)) {
-		DR_LOG(ERR, "Reformat flags don't fit HWS (flags: %x0x)\n",
+		DR_LOG(ERR, "Reformat flags don't fit HWS (flags: %x0x)",
 			flags);
 		rte_errno = EINVAL;
 		goto free_action;
@@ -1536,7 +1536,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_reformat_hws(ctx, data_sz, inline_data, log_bulk_size, action);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create reformat.\n");
+		DR_LOG(ERR, "Failed to create reformat.");
 		rte_errno = EINVAL;
 		goto free_action;
 	}
@@ -1605,14 +1605,14 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 
 	if (!mlx5dr_action_is_hws_flags(flags) ||
 	    ((flags & MLX5DR_ACTION_FLAG_SHARED) && log_bulk_size)) {
-		DR_LOG(ERR, "Flags don't fit hws (flags: %x0x, log_bulk_size: %d)\n",
+		DR_LOG(ERR, "Flags don't fit hws (flags: %x0x, log_bulk_size: %d)",
 			flags, log_bulk_size);
 		rte_errno = EINVAL;
 		goto free_action;
 	}
 
 	if (!mlx5dr_pat_arg_verify_actions(pattern, pattern_sz / MLX5DR_MODIFY_ACTION_SIZE)) {
-		DR_LOG(ERR, "One of the actions is not supported\n");
+		DR_LOG(ERR, "One of the actions is not supported");
 		rte_errno = EINVAL;
 		goto free_action;
 	}
@@ -1628,7 +1628,7 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 		ret = mlx5dr_pat_arg_create_modify_header(ctx, action, pattern_sz,
 							  pattern, log_bulk_size);
 		if (ret) {
-			DR_LOG(ERR, "Failed allocating modify-header\n");
+			DR_LOG(ERR, "Failed allocating modify-header");
 			goto free_action;
 		}
 	}
drivers/net/mlx5/hws/mlx5dr_cmd.c +1 -1
index f1ae256a7e..f9f220cc6a 100644
@@ -1134,7 +1134,7 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 
 		ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 		if (ret) {
-			DR_LOG(ERR, "Query eswitch capabilities failed %d\n", ret);
+			DR_LOG(ERR, "Query eswitch capabilities failed %d", ret);
 			rte_errno = errno;
 			return rte_errno;
 		}
drivers/net/mlx5/hws/mlx5dr_definer.c +2 -2
index 7b01f4c9ec..33d0f2d18e 100644
@@ -535,7 +535,7 @@ mlx5dr_definer_get_mpls_fc(struct mlx5dr_definer_conv_data *cd, bool inner)
 		break;
 	default:
 		rte_errno = ENOTSUP;
-		DR_LOG(ERR, "MPLS index %d is not supported\n", mpls_idx);
+		DR_LOG(ERR, "MPLS index %d is not supported", mpls_idx);
 		return NULL;
 	}
 
@@ -571,7 +571,7 @@ mlx5dr_definer_get_mpls_oks_fc(struct mlx5dr_definer_conv_data *cd, bool inner)
 		break;
 	default:
 		rte_errno = ENOTSUP;
-		DR_LOG(ERR, "MPLS index %d is not supported\n", mpls_idx);
+		DR_LOG(ERR, "MPLS index %d is not supported", mpls_idx);
 		return NULL;
 	}
 
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +2 -2
index 830bc08678..bedaedb677 100644
@@ -449,7 +449,7 @@ bool mlx5dr_pat_arg_verify_actions(__be64 pattern[], uint16_t num_of_actions)
 		u8 action_id =
 			MLX5_GET(set_action_in, &pattern[i], action_type);
 		if (action_id >= MLX5_MODIFICATION_TYPE_MAX) {
-			DR_LOG(ERR, "Invalid action %u\n", action_id);
+			DR_LOG(ERR, "Invalid action %u", action_id);
 			return false;
 		}
 	}
@@ -468,7 +468,7 @@ int mlx5dr_pat_arg_create_modify_header(struct mlx5dr_context *ctx,
 
 	num_of_actions = pattern_sz / MLX5DR_MODIFY_ACTION_SIZE;
 	if (num_of_actions == 0) {
-		DR_LOG(ERR, "Invalid number of actions %u\n", num_of_actions);
+		DR_LOG(ERR, "Invalid number of actions %u", num_of_actions);
 		rte_errno = EINVAL;
 		return rte_errno;
 	}
Signature · 1 line
2.18.1
#1 lore raw

PATCH 2/5 net/mlx5/hws: allow destroying rule resources on error

From: Alex Vesker <[email protected]>

In case the send engine is in error state API should provide a way to free rule resources and provide a fake completion. Otherwise there is no way to release these resources.

---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +5 -5
index 071e1ad769..931c68b160 100644
@@ -521,6 +521,11 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 
 	queue = &ctx->send_queue[attr->queue_id];
 
+	if (unlikely(mlx5dr_send_engine_err(queue))) {
+		mlx5dr_rule_destroy_failed_hws(rule, attr);
+		return 0;
+	}
+
 	/* Rule is not completed yet */
 	if (rule->status == MLX5DR_RULE_STATUS_CREATING) {
 		rte_errno = EBUSY;
@@ -533,11 +538,6 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 		return 0;
 	}
 
-	if (unlikely(mlx5dr_send_engine_err(queue))) {
-		mlx5dr_rule_destroy_failed_hws(rule, attr);
-		return 0;
-	}
-
 	mlx5dr_send_engine_inc_rule(queue);
 
 	/* Send dependent WQE */
Signature · 1 line
2.18.1
#2 lore raw

PATCH 3/5 net/mlx5/hws: remove duplicated reformat type

In reply to Itamar Gozlan

From: Shun Hao <[email protected]>

Currently there are two enum definitions for reformat type:
mlx5dr_action_reformat_type and mlx5dr_action_type. They are actually the same. This patch remove the unnecessary mlx5dr_action_reformat_type so use only one definition for reformat type.

---
 drivers/net/mlx5/hws/mlx5dr.h         |  19 ++---
 drivers/net/mlx5/hws/mlx5dr_action.c  | 110 ++++++++++----------------
 drivers/net/mlx5/hws/mlx5dr_debug.c   |   8 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c |   2 +-
 drivers/net/mlx5/mlx5_flow_hw.c       |  34 ++++----
 5 files changed, 68 insertions(+), 105 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +6 -13
index 7942fb0a8f..7d5af4c9bb 100644
@@ -29,10 +29,10 @@ enum mlx5dr_matcher_resource_mode {
 
 enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_LAST,
-	MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
-	MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	MLX5DR_ACTION_TYP_TNL_L3_TO_L2,
-	MLX5DR_ACTION_TYP_L2_TO_TNL_L3,
+	MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3,
 	MLX5DR_ACTION_TYP_DROP,
 	MLX5DR_ACTION_TYP_TIR,
 	MLX5DR_ACTION_TYP_FT,
@@ -62,13 +62,6 @@ enum mlx5dr_action_flags {
 	MLX5DR_ACTION_FLAG_SHARED = 1 << 6,
 };
 
-enum mlx5dr_action_reformat_type {
-	MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3,
-};
-
 enum mlx5dr_action_aso_meter_color {
 	MLX5DR_ACTION_ASO_METER_COLOR_RED = 0x0,
 	MLX5DR_ACTION_ASO_METER_COLOR_YELLOW = 0x1,
@@ -487,7 +480,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
  * @param[in] ctx
  *	The context in which the new action will be created.
  * @param[in] reformat_type
- *	Type of reformat.
+ *	Type of reformat prefixed with MLX5DR_ACTION_TYP_REFORMAT.
  * @param[in] data_sz
  *	Size in bytes of data.
  * @param[in] inline_data
@@ -500,7 +493,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
  */
 struct mlx5dr_action *
 mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
-			      enum mlx5dr_action_reformat_type reformat_type,
+			      enum mlx5dr_action_type reformat_type,
 			      size_t data_sz,
 			      void *inline_data,
 			      uint32_t log_bulk_size,
drivers/net/mlx5/hws/mlx5dr_action.c +40 -70

267 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_debug.c +4 -4
index d249f8d869..5064b23b7d 100644
@@ -6,10 +6,10 @@
 
 const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_LAST] = "LAST",
-	[MLX5DR_ACTION_TYP_TNL_L2_TO_L2] = "TNL_L2_TO_L2",
-	[MLX5DR_ACTION_TYP_L2_TO_TNL_L2] = "L2_TO_TNL_L2",
-	[MLX5DR_ACTION_TYP_TNL_L3_TO_L2] = "TNL_L3_TO_L2",
-	[MLX5DR_ACTION_TYP_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
+	[MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2] = "TNL_L2_TO_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2] = "L2_TO_TNL_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2] = "TNL_L3_TO_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
 	[MLX5DR_ACTION_TYP_DROP] = "DROP",
 	[MLX5DR_ACTION_TYP_TIR] = "TIR",
 	[MLX5DR_ACTION_TYP_FT] = "FT",
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +1 -1
index bedaedb677..309a61d477 100644
@@ -73,7 +73,7 @@ static bool mlx5dr_pat_compare_pattern(enum mlx5dr_action_type cur_type,
 		return false;
 
 	 /* All decap-l3 look the same, only change is the num of actions */
-	if (type == MLX5DR_ACTION_TYP_TNL_L3_TO_L2)
+	if (type == MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2)
 		return true;
 
 	for (i = 0; i < num_of_actions; i++) {
drivers/net/mlx5/mlx5_flow_hw.c +17 -17
index b5137a822a..e274fbf34d 100644
@@ -1418,7 +1418,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 	struct rte_flow_action *actions = at->actions;
 	struct rte_flow_action *action_start = actions;
 	struct rte_flow_action *masks = at->masks;
-	enum mlx5dr_action_reformat_type refmt_type = 0;
+	enum mlx5dr_action_type refmt_type = 0;
 	const struct rte_flow_action_raw_encap *raw_encap_data;
 	const struct rte_flow_item *enc_item = NULL, *enc_item_m = NULL;
 	uint16_t reformat_src = 0;
@@ -1573,7 +1573,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 					     masks->conf)->definition;
 			reformat_used = true;
 			reformat_src = actions - action_start;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 			MLX5_ASSERT(!reformat_used);
@@ -1584,13 +1584,13 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 					     masks->conf)->definition;
 			reformat_used = true;
 			reformat_src = actions - action_start;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
 			MLX5_ASSERT(!reformat_used);
 			reformat_used = true;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			raw_encap_data =
@@ -1606,18 +1606,18 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 			if (reformat_used) {
 				refmt_type = data_size <
 				MLX5_ENCAPSULATION_DECISION_SIZE ?
-				MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2 :
-				MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3;
+				MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :
+				MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
 			} else {
 				reformat_used = true;
 				refmt_type =
-				MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+				MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			}
 			reformat_src = actions - action_start;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 			reformat_used = true;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
 			flow_hw_translate_group(dev, cfg, attr->group,
@@ -4517,10 +4517,10 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR,
-	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	[RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
-	[RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
+	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	[RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
+	[RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
 	[RTE_FLOW_ACTION_TYPE_MODIFY_FIELD] = MLX5DR_ACTION_TYP_MODIFY_HDR,
 	[RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = MLX5DR_ACTION_TYP_VPORT,
 	[RTE_FLOW_ACTION_TYPE_CONNTRACK] = MLX5DR_ACTION_TYP_ASO_CT,
@@ -4598,7 +4598,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 	enum mlx5dr_action_type action_types[MLX5_HW_MAX_ACTS] = { MLX5DR_ACTION_TYP_LAST };
 	unsigned int i;
 	uint16_t curr_off;
-	enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
+	enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 	uint16_t reformat_off = UINT16_MAX;
 	uint16_t mhdr_off = UINT16_MAX;
 	uint16_t cnt_off = UINT16_MAX;
@@ -4636,16 +4636,16 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 			data_size = raw_encap_data->size;
 			if (reformat_off != UINT16_MAX) {
 				reformat_act_type = data_size < MLX5_ENCAPSULATION_DECISION_SIZE ?
-					MLX5DR_ACTION_TYP_TNL_L3_TO_L2 :
-					MLX5DR_ACTION_TYP_L2_TO_TNL_L3;
+					MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :
+					MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
 			} else {
 				reformat_off = curr_off++;
-				reformat_act_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2;
+				reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			}
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 			reformat_off = curr_off++;
-			reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
+			reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
 			if (mhdr_off == UINT16_MAX) {
Signature · 1 line
2.18.1
#3 lore raw

PATCH 4/5 net/mlx5/hws: renaming FT to TBL

In reply to Itamar Gozlan

An action naming change is made to describe the action better and avoid implicit meaning.

---
 drivers/net/mlx5/hws/mlx5dr.h        |  2 +-
 drivers/net/mlx5/hws/mlx5dr_action.c | 16 ++++++++--------
 drivers/net/mlx5/hws/mlx5dr_debug.c  |  2 +-
 drivers/net/mlx5/mlx5_flow_hw.c      |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +1 -1
index 7d5af4c9bb..ec2230d136 100644
@@ -35,7 +35,7 @@ enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3,
 	MLX5DR_ACTION_TYP_DROP,
 	MLX5DR_ACTION_TYP_TIR,
-	MLX5DR_ACTION_TYP_FT,
+	MLX5DR_ACTION_TYP_TBL,
 	MLX5DR_ACTION_TYP_CTR,
 	MLX5DR_ACTION_TYP_TAG,
 	MLX5DR_ACTION_TYP_MODIFY_HDR,
drivers/net/mlx5/hws/mlx5dr_action.c +8 -8
index 851cee8802..74f4e60863 100644
@@ -30,7 +30,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_TIR) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -48,7 +48,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
 		BIT(MLX5DR_ACTION_TYP_DEST_ROOT),
@@ -67,7 +67,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_VPORT) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -275,7 +275,7 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 		action = rule_actions[i].action;
 
 		switch (action->type) {
-		case MLX5DR_ACTION_TYP_FT:
+		case MLX5DR_ACTION_TYP_TBL:
 		case MLX5DR_ACTION_TYP_TIR:
 			attr[i].type = MLX5DV_FLOW_ACTION_DEST_DEVX;
 			attr[i].obj = action->devx_obj;
@@ -519,7 +519,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 			attr->modify_header.pattern_id = action->modify_header.pattern_obj->id;
 		}
 		break;
-	case MLX5DR_ACTION_TYP_FT:
+	case MLX5DR_ACTION_TYP_TBL:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_FT;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
 		attr->dest_table_id = obj->id;
@@ -747,7 +747,7 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx,
 		return NULL;
 	}
 
-	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_FT);
+	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_TBL);
 	if (!action)
 		return NULL;
 
@@ -1681,7 +1681,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
 	case MLX5DR_ACTION_TYP_TAG:
 	case MLX5DR_ACTION_TYP_DROP:
 	case MLX5DR_ACTION_TYP_CTR:
-	case MLX5DR_ACTION_TYP_FT:
+	case MLX5DR_ACTION_TYP_TBL:
 	case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
 	case MLX5DR_ACTION_TYP_ASO_METER:
 	case MLX5DR_ACTION_TYP_ASO_CT:
@@ -2178,7 +2178,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
 		switch (action_type[i]) {
 		case MLX5DR_ACTION_TYP_DROP:
 		case MLX5DR_ACTION_TYP_TIR:
-		case MLX5DR_ACTION_TYP_FT:
+		case MLX5DR_ACTION_TYP_TBL:
 		case MLX5DR_ACTION_TYP_DEST_ROOT:
 		case MLX5DR_ACTION_TYP_VPORT:
 		case MLX5DR_ACTION_TYP_MISS:
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -1
index 5064b23b7d..48810142a0 100644
@@ -12,7 +12,7 @@ const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
 	[MLX5DR_ACTION_TYP_DROP] = "DROP",
 	[MLX5DR_ACTION_TYP_TIR] = "TIR",
-	[MLX5DR_ACTION_TYP_FT] = "FT",
+	[MLX5DR_ACTION_TYP_TBL] = "TBL",
 	[MLX5DR_ACTION_TYP_CTR] = "CTR",
 	[MLX5DR_ACTION_TYP_TAG] = "TAG",
 	[MLX5DR_ACTION_TYP_MODIFY_HDR] = "MODIFY_HDR",
drivers/net/mlx5/mlx5_flow_hw.c +2 -2
index e274fbf34d..bbe0c5ec8a 100644
@@ -4514,7 +4514,7 @@ flow_hw_actions_validate(struct rte_eth_dev *dev,
 static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_MARK] = MLX5DR_ACTION_TYP_TAG,
 	[RTE_FLOW_ACTION_TYPE_DROP] = MLX5DR_ACTION_TYP_DROP,
-	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT,
+	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_TBL,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
@@ -4659,7 +4659,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 			action_types[curr_off++] = MLX5DR_ACTION_TYP_ASO_METER;
 			if (curr_off >= MLX5_HW_MAX_ACTS)
 				goto err_actions_num;
-			action_types[curr_off++] = MLX5DR_ACTION_TYP_FT;
+			action_types[curr_off++] = MLX5DR_ACTION_TYP_TBL;
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
 			type = mlx5_hw_dr_action_types[at->actions[i].type];
Signature · 1 line
2.18.1
#4 lore raw

PATCH 5/5 net/mlx5/hws: support default miss action on FDB

In reply to Itamar Gozlan

From: Alex Vesker <[email protected]>

Add the support for default miss on HWS FDB, this implementation was missing until now. Default miss can be used for more efficient miss flow instead of going to an empty matcher or some defecated empty table.

---
 drivers/net/mlx5/hws/mlx5dr_table.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/mlx5/hws/mlx5dr_table.c +1 -5
index c18ee7c552..fd5b54ff0b 100644
@@ -24,7 +24,6 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	struct mlx5dr_cmd_forward_tbl *default_miss;
 	struct mlx5dr_context *ctx = tbl->ctx;
 	uint8_t tbl_type = tbl->type;
-	uint32_t vport;
 
 	if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
 		return 0;
@@ -38,12 +37,9 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	ft_attr.level = tbl->ctx->caps->fdb_ft.max_level; /* The last level */
 	ft_attr.rtc_valid = false;
 
-	assert(ctx->caps->eswitch_manager);
-	vport = ctx->caps->eswitch_manager_vport_number;
-
 	fte_attr.action_flags = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 	fte_attr.destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-	fte_attr.destination_id = vport;
+	fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number;;
 
 	default_miss = mlx5dr_cmd_forward_tbl_create(mlx5dr_context_get_local_ibv(ctx),
 						     &ft_attr, &fte_attr);
Signature · 1 line
2.18.1
#5 lore raw

PATCH v2 1/5 net/mlx5: support indirect list METER_MARK action

From: Gregory Etelson <[email protected]>

---
 drivers/net/mlx5/mlx5_flow.c    |  69 +++++-
 drivers/net/mlx5/mlx5_flow.h    |  67 ++++-
 drivers/net/mlx5/mlx5_flow_hw.c | 419 +++++++++++++++++++++++++++-----
 3 files changed, 476 insertions(+), 79 deletions(-)
drivers/net/mlx5/mlx5_flow.c +67 -2
index 29e9819dd6..fb7b82fa26 100644
@@ -63,8 +63,11 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 		switch (e->type) {
 #ifdef HAVE_MLX5_HWS_SUPPORT
 		case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
-			mlx5_hw_mirror_destroy(dev, (struct mlx5_mirror *)e, true);
+			mlx5_hw_mirror_destroy(dev, (struct mlx5_mirror *)e);
 		break;
+		case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
+			mlx5_destroy_legacy_indirect(dev, e);
+			break;
 #endif
 		default:
 			DRV_LOG(ERR, "invalid indirect list type");
@@ -1156,7 +1159,24 @@ mlx5_flow_async_action_list_handle_destroy
 			 const struct rte_flow_op_attr *op_attr,
 			 struct rte_flow_action_list_handle *action_handle,
 			 void *user_data, struct rte_flow_error *error);
-
+static int
+mlx5_flow_action_list_handle_query_update(struct rte_eth_dev *dev,
+					  const
+					  struct rte_flow_action_list_handle *handle,
+					  const void **update, void **query,
+					  enum rte_flow_query_update_mode mode,
+					  struct rte_flow_error *error);
+static int
+mlx5_flow_async_action_list_handle_query_update(struct rte_eth_dev *dev,
+						uint32_t queue_id,
+						const struct rte_flow_op_attr *attr,
+						const struct
+						rte_flow_action_list_handle *handle,
+						const void **update,
+						void **query,
+						enum rte_flow_query_update_mode mode,
+						void *user_data,
+						struct rte_flow_error *error);
 static const struct rte_flow_ops mlx5_flow_ops = {
 	.validate = mlx5_flow_validate,
 	.create = mlx5_flow_create,
@@ -1206,6 +1226,10 @@ static const struct rte_flow_ops mlx5_flow_ops = {
 		mlx5_flow_async_action_list_handle_create,
 	.async_action_list_handle_destroy =
 		mlx5_flow_async_action_list_handle_destroy,
+	.action_list_handle_query_update =
+		mlx5_flow_action_list_handle_query_update,
+	.async_action_list_handle_query_update =
+		mlx5_flow_async_action_list_handle_query_update,
 };
 
 /* Tunnel information. */
@@ -11054,6 +11078,47 @@ mlx5_flow_async_action_list_handle_destroy
 						      error);
 }
 
+static int
+mlx5_flow_action_list_handle_query_update(struct rte_eth_dev *dev,
+					  const
+					  struct rte_flow_action_list_handle *handle,
+					  const void **update, void **query,
+					  enum rte_flow_query_update_mode mode,
+					  struct rte_flow_error *error)
+{
+	const struct mlx5_flow_driver_ops *fops;
+
+	MLX5_DRV_FOPS_OR_ERR(dev, fops,
+			     action_list_handle_query_update, ENOTSUP);
+	return fops->action_list_handle_query_update(dev, handle, update, query,
+						     mode, error);
+}
+
+static int
+mlx5_flow_async_action_list_handle_query_update(struct rte_eth_dev *dev,
+						uint32_t queue_id,
+						const
+						struct rte_flow_op_attr *op_attr,
+						const struct
+						rte_flow_action_list_handle *handle,
+						const void **update,
+						void **query,
+						enum
+						rte_flow_query_update_mode mode,
+						void *user_data,
+						struct rte_flow_error *error)
+{
+	const struct mlx5_flow_driver_ops *fops;
+
+	MLX5_DRV_FOPS_OR_ERR(dev, fops,
+			     async_action_list_handle_query_update, ENOTSUP);
+	return fops->async_action_list_handle_query_update(dev, queue_id, op_attr,
+							   handle, update,
+							   query, mode,
+							   user_data, error);
+}
+
+
 /**
  * Destroy all indirect actions (shared RSS).
  *
drivers/net/mlx5/mlx5_flow.h +54 -13

113 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +355 -64

590 lines not on this page · raw message

Signature · 1 line
2.18.1
#6 lore raw

PATCH v2 2/5 app/testpmd: support indirect actions list syntax

From: Gregory Etelson <[email protected]>

Syntax:
actions .. indirect_list handle H conf C ..

H references shared action resources related to that handle. C references configuration array:
if H was created from a list of actions A1 / A2 / ... / END, C[i] points to a flow configuration update of A[i].

---
 app/test-pmd/cmdline_flow.c | 227 +++++++++++++++++++++++++++++++++---
 app/test-pmd/config.c       |   5 +-
 app/test-pmd/testpmd.h      |   2 +-
 3 files changed, 215 insertions(+), 19 deletions(-)
app/test-pmd/cmdline_flow.c +212 -15
index 7eb8e045b4..1644328bf4 100644
@@ -66,6 +66,7 @@ enum index {
 	COMMON_ACTIONS_TEMPLATE_ID,
 	COMMON_TABLE_ID,
 	COMMON_QUEUE_ID,
+	COMMON_METER_COLOR_NAME,
 
 	/* TOP-level command. */
 	ADD,
@@ -253,6 +254,7 @@ enum index {
 	/* Indirect action arguments */
 	INDIRECT_ACTION_CREATE,
 	INDIRECT_ACTION_LIST_CREATE,
+	INDIRECT_ACTION_FLOW_CONF_CREATE,
 	INDIRECT_ACTION_UPDATE,
 	INDIRECT_ACTION_DESTROY,
 	INDIRECT_ACTION_QUERY,
@@ -265,6 +267,7 @@ enum index {
 	INDIRECT_ACTION_TRANSFER,
 	INDIRECT_ACTION_SPEC,
 	INDIRECT_ACTION_LIST,
+	INDIRECT_ACTION_FLOW_CONF,
 
 	/* Indirect action destroy arguments */
 	INDIRECT_ACTION_DESTROY_ID,
@@ -529,7 +532,6 @@ enum index {
 	ITEM_PPP_PROTO_ID,
 	ITEM_METER,
 	ITEM_METER_COLOR,
-	ITEM_METER_COLOR_NAME,
 	ITEM_QUOTA,
 	ITEM_QUOTA_STATE,
 	ITEM_QUOTA_STATE_NAME,
@@ -585,6 +587,8 @@ enum index {
 	ACTION_METER_COLOR_RED,
 	ACTION_METER_ID,
 	ACTION_METER_MARK,
+	ACTION_METER_MARK_CONF,
+	ACTION_METER_MARK_CONF_COLOR,
 	ACTION_METER_PROFILE,
 	ACTION_METER_PROFILE_ID2PTR,
 	ACTION_METER_POLICY,
@@ -669,6 +673,10 @@ enum index {
 	ACTION_SAMPLE_INDEX_VALUE,
 	ACTION_INDIRECT,
 	ACTION_INDIRECT_LIST,
+	ACTION_INDIRECT_LIST_HANDLE,
+	ACTION_INDIRECT_LIST_CONF,
+	INDIRECT_LIST_ACTION_ID2PTR_HANDLE,
+	INDIRECT_LIST_ACTION_ID2PTR_CONF,
 	ACTION_SHARED_INDIRECT,
 	INDIRECT_ACTION_ID2PTR,
 	ACTION_MODIFY_FIELD,
@@ -1366,6 +1374,7 @@ static const enum index next_ia_create_attr[] = {
 	INDIRECT_ACTION_TRANSFER,
 	INDIRECT_ACTION_SPEC,
 	INDIRECT_ACTION_LIST,
+	INDIRECT_ACTION_FLOW_CONF,
 	ZERO,
 };
 
@@ -1375,6 +1384,13 @@ static const enum index next_ia[] = {
 	ZERO
 };
 
+static const enum index next_ial[] = {
+	ACTION_INDIRECT_LIST_HANDLE,
+	ACTION_INDIRECT_LIST_CONF,
+	ACTION_NEXT,
+	ZERO
+};
+
 static const enum index next_shia[] = {
 	COMMON_INDIRECT_ACTION_PORT,
 	ACTION_NEXT,
@@ -2075,6 +2091,7 @@ static const enum index next_action[] = {
 	ACTION_METER,
 	ACTION_METER_COLOR,
 	ACTION_METER_MARK,
+	ACTION_METER_MARK_CONF,
 	ACTION_OF_DEC_NW_TTL,
 	ACTION_OF_POP_VLAN,
 	ACTION_OF_PUSH_VLAN,
@@ -2754,6 +2771,10 @@ static int parse_ia_destroy(struct context *ctx, const struct token *token,
 static int parse_ia_id2ptr(struct context *ctx, const struct token *token,
 			   const char *str, unsigned int len, void *buf,
 			   unsigned int size);
+
+static int parse_indlst_id2ptr(struct context *ctx, const struct token *token,
+			       const char *str, unsigned int len, void *buf,
+			       unsigned int size);
 static int parse_ia_port(struct context *ctx, const struct token *token,
 			 const char *str, unsigned int len, void *buf,
 			 unsigned int size);
@@ -2842,6 +2863,16 @@ static int comp_insertion_table_type(struct context *, const struct token *,
 static int comp_hash_table_type(struct context *, const struct token *,
 				unsigned int, char *, unsigned int);
 
+struct indlst_conf {
+	uint32_t id;
+	uint32_t conf_num;
+	struct rte_flow_action *actions;
+	const void **conf;
+	SLIST_ENTRY(indlst_conf) next;
+};
+
+static const struct indlst_conf *indirect_action_list_conf_get(uint32_t conf_id);
+
 /** Token definitions. */
 static const struct token token_list[] = {
 	/* Special tokens. */
@@ -3026,6 +3057,12 @@ static const struct token token_list[] = {
 		.call = parse_int,
 		.comp = comp_queue_id,
 	},
+	[COMMON_METER_COLOR_NAME] = {
+		.name = "color_name",
+		.help = "meter color name",
+		.call = parse_meter_color,
+		.comp = comp_meter_color,
+	},
 	/* Top-level command. */
 	[FLOW] = {
 		.name = "flow",
@@ -5769,17 +5806,11 @@ static const struct token token_list[] = {
 		.name = "color",
 		.help = "meter color",
 		.next = NEXT(item_meter,
-			     NEXT_ENTRY(ITEM_METER_COLOR_NAME),
+			     NEXT_ENTRY(COMMON_METER_COLOR_NAME),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_meter_color,
 					color)),
 	},
-	[ITEM_METER_COLOR_NAME] = {
-		.name = "color_name",
-		.help = "meter color name",
-		.call = parse_meter_color,
-		.comp = comp_meter_color,
-	},
 	[ITEM_QUOTA] = {
 		.name = "quota",
 		.help = "match quota",
@@ -6165,6 +6196,23 @@ static const struct token token_list[] = {
 		.next = NEXT(action_meter_mark),
 		.call = parse_vc,
 	},
+	[ACTION_METER_MARK_CONF] = {
+		.name = "meter_mark_conf",
+		.help = "meter mark configuration",
+		.priv = PRIV_ACTION(METER_MARK,
+				    sizeof(struct rte_flow_action_meter_mark)),
+		.next = NEXT(NEXT_ENTRY(ACTION_METER_MARK_CONF_COLOR)),
+		.call = parse_vc,
+	},
+	[ACTION_METER_MARK_CONF_COLOR] = {
+		.name = "mtr_update_init_color",
+		.help = "meter update init color",
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT),
+			     NEXT_ENTRY(COMMON_METER_COLOR_NAME)),
+		.args = ARGS(ARGS_ENTRY
+			     (struct rte_flow_indirect_update_flow_meter_mark,
+			      init_color)),
+	},
 	[ACTION_METER_PROFILE] = {
 		.name = "mtr_profile",
 		.help = "meter profile id to use",
@@ -7277,11 +7325,36 @@ static const struct token token_list[] = {
 	[ACTION_INDIRECT_LIST] = {
 		.name = "indirect_list",
 		.help = "apply indirect list action by id",
-		.priv = PRIV_ACTION(INDIRECT_LIST, 0),
-		.next = NEXT(next_ia),
-		.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uint32_t))),
+		.priv = PRIV_ACTION(INDIRECT_LIST,
+				    sizeof(struct
+				           rte_flow_action_indirect_list)),
+		.next = NEXT(next_ial),
 		.call = parse_vc,
 	},
+	[ACTION_INDIRECT_LIST_HANDLE] = {
+		.name = "handle",
+		.help = "indirect list handle",
+		.next = NEXT(next_ial, NEXT_ENTRY(INDIRECT_LIST_ACTION_ID2PTR_HANDLE)),
+		.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uintptr_t))),
+	},
+	[ACTION_INDIRECT_LIST_CONF] = {
+		.name = "conf",
+		.help = "indirect list configuration",
+		.next = NEXT(next_ial, NEXT_ENTRY(INDIRECT_LIST_ACTION_ID2PTR_CONF)),
+		.args = ARGS(ARGS_ENTRY_ARB(0, sizeof(uintptr_t))),
+	},
+	[INDIRECT_LIST_ACTION_ID2PTR_HANDLE] = {
+		.type = "UNSIGNED",
+		.help = "unsigned integer value",
+		.call = parse_indlst_id2ptr,
+//		.comp = comp_none,
+	},
+	[INDIRECT_LIST_ACTION_ID2PTR_CONF] = {
+		.type = "UNSIGNED",
+		.help = "unsigned integer value",
+		.call = parse_indlst_id2ptr,
+//		.comp = comp_none,
+	},
 	[ACTION_SHARED_INDIRECT] = {
 		.name = "shared_indirect",
 		.help = "apply indirect action by id and port",
@@ -7336,6 +7409,12 @@ static const struct token token_list[] = {
 		.next = NEXT(NEXT_ENTRY(ACTIONS, END)),
 		.call = parse_ia,
 	},
+	[INDIRECT_ACTION_FLOW_CONF] = {
+		.name = "flow_conf",
+		.help = "specify actions configuration for indirect handle list",
+		.next = NEXT(NEXT_ENTRY(ACTIONS, END)),
+		.call = parse_ia,
+	},
 	[ACTION_POL_G] = {
 		.name = "g_actions",
 		.help = "submit a list of associated actions for green",
@@ -7811,6 +7890,9 @@ parse_ia(struct context *ctx, const struct token *token,
 	case INDIRECT_ACTION_LIST:
 		out->command = INDIRECT_ACTION_LIST_CREATE;
 		return len;
+        case INDIRECT_ACTION_FLOW_CONF:
+		out->command = INDIRECT_ACTION_FLOW_CONF_CREATE;
+		return len;
 	default:
 		return -1;
 	}
@@ -11317,6 +11399,49 @@ parse_ia_id2ptr(struct context *ctx, const struct token *token,
 	return ret;
 }
 
+static int
+parse_indlst_id2ptr(struct context *ctx, const struct token *token,
+		    const char *str, unsigned int len,
+		    void __rte_unused *buf, unsigned int __rte_unused size)
+{
+	struct rte_flow_action *action = ctx->object;
+	struct rte_flow_action_indirect_list *action_conf;
+	const struct indlst_conf *indlst_conf;
+	uint32_t id;
+	int ret;
+
+	if (!action)
+		return -1;
+	ctx->objdata = 0;
+	ctx->object = &id;
+	ctx->objmask = NULL;
+	ret = parse_int(ctx, token, str, len, ctx->object, sizeof(id));
+	if (ret != (int)len)
+		return ret;
+	ctx->object = action;
+	action_conf = (void *)(uintptr_t)action->conf;
+	action_conf->conf = NULL;
+	switch (ctx->curr) {
+	case INDIRECT_LIST_ACTION_ID2PTR_HANDLE:
+        action_conf->handle = (typeof(action_conf->handle))
+				port_action_handle_get_by_id(ctx->port, id);
+		if (!action_conf->handle) {
+			printf("no indirect list handle for id %u\n", id);
+			return -1;
+		}
+		break;
+	case INDIRECT_LIST_ACTION_ID2PTR_CONF:
+		indlst_conf = indirect_action_list_conf_get(id);
+		if (!indlst_conf)
+			return -1;
+		action_conf->conf = (const void **)indlst_conf->conf;
+		break;
+	default:
+		break;
+	}
+	return ret;
+}
+
 static int
 parse_meter_profile_id2ptr(struct context *ctx, const struct token *token,
 		const char *str, unsigned int len,
@@ -11549,11 +11674,10 @@ parse_meter_color(struct context *ctx, const struct token *token,
 		  const char *str, unsigned int len, void *buf,
 		  unsigned int size)
 {
-	struct rte_flow_item_meter_color *meter_color;
 	unsigned int i;
+	struct buffer *out = buf;
 
 	(void)token;
-	(void)buf;
 	(void)size;
 	for (i = 0; meter_colors[i]; ++i)
 		if (!strcmp_partial(meter_colors[i], str, len))
@@ -11562,8 +11686,18 @@ parse_meter_color(struct context *ctx, const struct token *token,
 		return -1;
 	if (!ctx->object)
 		return len;
-	meter_color = ctx->object;
-	meter_color->color = (enum rte_color)i;
+	if (ctx->prev == ACTION_METER_MARK_CONF_COLOR) {
+		struct rte_flow_action *action =
+			out->args.vc.actions + out->args.vc.actions_n - 1;
+		const struct arg *arg = pop_args(ctx);
+
+		if (!arg)
+			return -1;
+		*(int *)RTE_PTR_ADD(action->conf, arg->offset) = i;
+	} else {
+		((struct rte_flow_item_meter_color *)
+			ctx->object)->color = (enum rte_color)i;
+	}
 	return len;
 }
 
@@ -12356,6 +12490,64 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 	*hdr = &cmd_flow_token_hdr;
 }
 
+static SLIST_HEAD(, indlst_conf) indlst_conf_head =
+	SLIST_HEAD_INITIALIZER();
+
+static void
+indirect_action_flow_conf_create(const struct buffer *in)
+{
+	int len, ret;
+	uint32_t i;
+	struct indlst_conf *indlst_conf = NULL;
+	size_t base = RTE_ALIGN(sizeof(*indlst_conf), 8);
+	struct rte_flow_action *src = in->args.vc.actions;
+
+	if (!in->args.vc.actions_n)
+		goto end;
+	len = rte_flow_conv(RTE_FLOW_CONV_OP_ACTIONS, NULL, 0, src, NULL);
+	if (len <= 0)
+		goto end;
+	len = RTE_ALIGN(len, 16);
+
+	indlst_conf = calloc(1, base + len +
+			     in->args.vc.actions_n * sizeof(uintptr_t));
+	if (!indlst_conf)
+		goto end;
+	indlst_conf->id = in->args.vc.attr.group;
+	indlst_conf->conf_num = in->args.vc.actions_n - 1;
+	indlst_conf->actions = RTE_PTR_ADD(indlst_conf, base);
+	ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTIONS, indlst_conf->actions,
+			    len, src, NULL);
+	if (ret <= 0) {
+		free(indlst_conf);
+		indlst_conf = NULL;
+		goto end;
+	}
+	indlst_conf->conf = RTE_PTR_ADD(indlst_conf, base + len);
+	for (i = 0; i < indlst_conf->conf_num; i++)
+		indlst_conf->conf[i] = indlst_conf->actions[i].conf;
+	SLIST_INSERT_HEAD(&indlst_conf_head, indlst_conf, next);
+end:
+	if (indlst_conf)
+        printf("created indirect action list configuration %u\n",
+               in->args.vc.attr.group);
+	else
+        printf("cannot create indirect action list configuration %u\n",
+               in->args.vc.attr.group);
+}
+
+static const struct indlst_conf *
+indirect_action_list_conf_get(uint32_t conf_id)
+{
+	const struct indlst_conf *conf;
+
+	SLIST_FOREACH(conf, &indlst_conf_head, next) {
+		if (conf->id == conf_id)
+			return conf;
+	}
+	return NULL;
+}
+
 /** Dispatch parsed buffer to function calls. */
 static void
 cmd_flow_parsed(const struct buffer *in)
@@ -12479,6 +12671,7 @@ cmd_flow_parsed(const struct buffer *in)
 	case INDIRECT_ACTION_LIST_CREATE:
 		port_action_handle_create(
 				in->port, in->args.vc.attr.group,
+				in->command == INDIRECT_ACTION_LIST_CREATE,
 				&((const struct rte_flow_indir_action_conf) {
 					.ingress = in->args.vc.attr.ingress,
 					.egress = in->args.vc.attr.egress,
@@ -12486,6 +12679,9 @@ cmd_flow_parsed(const struct buffer *in)
 				}),
 				in->args.vc.actions);
 		break;
+	case INDIRECT_ACTION_FLOW_CONF_CREATE:
+		indirect_action_flow_conf_create(in);
+		break;
 	case INDIRECT_ACTION_DESTROY:
 		port_action_handle_destroy(in->port,
 					   in->args.ia_destroy.action_id_n,
@@ -12563,6 +12759,7 @@ cmd_flow_parsed(const struct buffer *in)
 	default:
 		break;
 	}
+	fflush(stdout);
 }
 
 /** Token generator and output processing callback (cmdline API). */
app/test-pmd/config.c +2 -3
index 36cfa7fe95..5ae4cb9a25 100644
@@ -1780,21 +1780,20 @@ action_list_handle_create(portid_t port_id,
 }
 /** Create indirect action */
 int
-port_action_handle_create(portid_t port_id, uint32_t id,
+port_action_handle_create(portid_t port_id, uint32_t id, bool indirect_list,
 			  const struct rte_flow_indir_action_conf *conf,
 			  const struct rte_flow_action *action)
 {
 	struct port_indirect_action *pia;
 	int ret;
 	struct rte_flow_error error;
-	bool is_indirect_list = action[1].type != RTE_FLOW_ACTION_TYPE_END;
 
 	ret = action_alloc(port_id, id, &pia);
 	if (ret)
 		return ret;
 	/* Poisoning to make sure PMDs update it in case of error. */
 	memset(&error, 0x22, sizeof(error));
-	ret = is_indirect_list ?
+	ret = indirect_list ?
 	       action_list_handle_create(port_id, pia, conf, action, &error) :
 	       action_handle_create(port_id, pia, conf, action, &error);
 	if (ret) {
app/test-pmd/testpmd.h +1 -1
index eed5c70608..2e888cb2f9 100644
@@ -903,7 +903,7 @@ void update_fwd_ports(portid_t new_pid);
 void set_fwd_eth_peer(portid_t port_id, char *peer_addr);
 
 void port_mtu_set(portid_t port_id, uint16_t mtu);
-int port_action_handle_create(portid_t port_id, uint32_t id,
+int port_action_handle_create(portid_t port_id, uint32_t id, bool indirect_list,
 			      const struct rte_flow_indir_action_conf *conf,
 			      const struct rte_flow_action *action);
 int port_action_handle_destroy(portid_t port_id,
Signature · 1 line
2.18.1
#7 lore raw

PATCH v2 3/5 net/mlx5: add indirect encap decap support

In reply to Itamar Gozlan

From: Rongwei Liu <[email protected]>

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules.
The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

---
 drivers/net/mlx5/mlx5_flow.c    |   5 +
 drivers/net/mlx5/mlx5_flow.h    |  16 ++
 drivers/net/mlx5/mlx5_flow_hw.c | 323 ++++++++++++++++++++++++++++++++
 3 files changed, 344 insertions(+)
drivers/net/mlx5/mlx5_flow.c +5 -0
index fb7b82fa26..45f2210ae7 100644
@@ -54,6 +54,7 @@ void
 mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
+	struct rte_flow_error error;
 
 	while (!LIST_EMPTY(&priv->indirect_list_head)) {
 		struct mlx5_indirect_list *e =
@@ -68,6 +69,10 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 		case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
 			mlx5_destroy_legacy_indirect(dev, e);
 			break;
+		case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+			mlx5_reformat_action_destroy(dev,
+				(struct rte_flow_action_list_handle *)e, &error);
+			break;
 #endif
 		default:
 			DRV_LOG(ERR, "invalid indirect list type");
drivers/net/mlx5/mlx5_flow.h +16 -0
index 46bfd4d8a7..e273bd958d 100644
@@ -116,6 +116,7 @@ enum mlx5_indirect_list_type {
 	MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 2,
+	MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT = 3,
 };
 
 /**
@@ -1433,6 +1434,8 @@ struct mlx5_hw_jump_action {
 
 /* Encap decap action struct. */
 struct mlx5_hw_encap_decap_action {
+	struct mlx5_indirect_list indirect;
+	enum mlx5dr_action_type action_type;
 	struct mlx5dr_action *action; /* Action object. */
 	/* Is header_reformat action shared across flows in table. */
 	bool shared;
@@ -2596,6 +2599,16 @@ flow_hw_validate_action_ipsec(struct rte_eth_dev *dev,
 			      uint64_t action_flags,
 			      struct rte_flow_error *error);
 
+struct mlx5_hw_encap_decap_action*
+mlx5_reformat_action_create(struct rte_eth_dev *dev,
+			    const struct rte_flow_indir_action_conf *conf,
+			    const struct rte_flow_action *encap_action,
+			    const struct rte_flow_action *decap_action,
+			    struct rte_flow_error *error);
+int mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
+				 struct rte_flow_action_list_handle *handle,
+				 struct rte_flow_error *error);
+
 int mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
 				    const struct rte_flow_attr *attr,
 				    struct rte_flow_error *error);
@@ -3041,5 +3054,8 @@ mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror);
 void
 mlx5_destroy_legacy_indirect(struct rte_eth_dev *dev,
 			     struct mlx5_indirect_list *ptr);
+void
+mlx5_hw_decap_encap_destroy(struct rte_eth_dev *dev,
+			    struct mlx5_indirect_list *reformat);
 #endif
 #endif /* RTE_PMD_MLX5_FLOW_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +323 -0

375 lines not on this page · raw message

Signature · 1 line
2.18.1
#8 lore raw

PATCH v2 4/5 net/mlx5: support symmetric RSS hash function

In reply to Itamar Gozlan

From: Xueming Li <[email protected]>

This patch supports symmetric hash function that creating same hash result for bi-direction traffic which having reverse source and destination IP and L4 port.

Since the hash algorithom is different than spec(XOR), leave a warning in validation.

---
 drivers/net/mlx5/mlx5.h         |  3 +++
 drivers/net/mlx5/mlx5_devx.c    | 11 ++++++++---
 drivers/net/mlx5/mlx5_flow.c    | 10 ++++++++--
 drivers/net/mlx5/mlx5_flow.h    |  5 +++++
 drivers/net/mlx5/mlx5_flow_dv.c | 13 ++++++++++++-
 drivers/net/mlx5/mlx5_flow_hw.c |  7 +++++++
 drivers/net/mlx5/mlx5_rx.h      |  2 +-
 drivers/net/mlx5/mlx5_rxq.c     |  8 +++++---
 8 files changed, 49 insertions(+), 10 deletions(-)
drivers/net/mlx5/mlx5.h +3 -0
index b5b809633c..4fc67c4f36 100644
@@ -1579,6 +1579,7 @@ struct mlx5_mtr_config {
 
 /* RSS description. */
 struct mlx5_flow_rss_desc {
+	bool symmetric_hash_function; /**< Symmetric hash function */
 	uint32_t level;
 	uint32_t queue_num; /**< Number of entries in @p queue. */
 	uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
@@ -1647,6 +1648,7 @@ struct mlx5_hrxq {
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
 	void *action; /* DV QP action pointer. */
 #endif
+	bool symmetric_hash_function; /* Symmetric hash function */
 	uint32_t hws_flags; /* Hw steering flags. */
 	uint64_t hash_fields; /* Verbs Hash fields. */
 	uint32_t rss_key_len; /* Hash key length in bytes. */
@@ -1718,6 +1720,7 @@ struct mlx5_obj_ops {
 	int (*hrxq_modify)(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
 			   const uint8_t *rss_key,
 			   uint64_t hash_fields,
+			   bool symmetric_hash_function,
 			   const struct mlx5_ind_table_obj *ind_tbl);
 	void (*hrxq_destroy)(struct mlx5_hrxq *hrxq);
 	int (*drop_action_create)(struct rte_eth_dev *dev);
drivers/net/mlx5/mlx5_devx.c +8 -3
index 5082a7e178..d286cfe864 100644
@@ -803,7 +803,8 @@ static void
 mlx5_devx_tir_attr_set(struct rte_eth_dev *dev, const uint8_t *rss_key,
 		       uint64_t hash_fields,
 		       const struct mlx5_ind_table_obj *ind_tbl,
-		       int tunnel, struct mlx5_devx_tir_attr *tir_attr)
+		       int tunnel, bool symmetric_hash_function,
+		       struct mlx5_devx_tir_attr *tir_attr)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	bool is_hairpin;
@@ -834,6 +835,7 @@ mlx5_devx_tir_attr_set(struct rte_eth_dev *dev, const uint8_t *rss_key,
 	tir_attr->disp_type = MLX5_TIRC_DISP_TYPE_INDIRECT;
 	tir_attr->rx_hash_fn = MLX5_RX_HASH_FN_TOEPLITZ;
 	tir_attr->tunneled_offload_en = !!tunnel;
+	tir_attr->rx_hash_symmetric = symmetric_hash_function;
 	/* If needed, translate hash_fields bitmap to PRM format. */
 	if (hash_fields) {
 		struct mlx5_rx_hash_field_select *rx_hash_field_select =
@@ -902,7 +904,8 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
 	int err;
 
 	mlx5_devx_tir_attr_set(dev, hrxq->rss_key, hrxq->hash_fields,
-			       hrxq->ind_table, tunnel, &tir_attr);
+			       hrxq->ind_table, tunnel, hrxq->symmetric_hash_function,
+			       &tir_attr);
 	hrxq->tir = mlx5_devx_cmd_create_tir(priv->sh->cdev->ctx, &tir_attr);
 	if (!hrxq->tir) {
 		DRV_LOG(ERR, "Port %u cannot create DevX TIR.",
@@ -969,13 +972,13 @@ static int
 mlx5_devx_hrxq_modify(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
 		       const uint8_t *rss_key,
 		       uint64_t hash_fields,
+		       bool symmetric_hash_function,
 		       const struct mlx5_ind_table_obj *ind_tbl)
 {
 	struct mlx5_devx_modify_tir_attr modify_tir = {0};
 
 	/*
 	 * untested for modification fields:
-	 * - rx_hash_symmetric not set in hrxq_new(),
 	 * - rx_hash_fn set hard-coded in hrxq_new(),
 	 * - lro_xxx not set after rxq setup
 	 */
@@ -983,11 +986,13 @@ mlx5_devx_hrxq_modify(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
 		modify_tir.modify_bitmask |=
 			MLX5_MODIFY_TIR_IN_MODIFY_BITMASK_INDIRECT_TABLE;
 	if (hash_fields != hrxq->hash_fields ||
+			symmetric_hash_function != hrxq->symmetric_hash_function ||
 			memcmp(hrxq->rss_key, rss_key, MLX5_RSS_HASH_KEY_LEN))
 		modify_tir.modify_bitmask |=
 			MLX5_MODIFY_TIR_IN_MODIFY_BITMASK_HASH;
 	mlx5_devx_tir_attr_set(dev, rss_key, hash_fields, ind_tbl,
 			       0, /* N/A - tunnel modification unsupported */
+			       symmetric_hash_function,
 			       &modify_tir.tir);
 	modify_tir.tirn = hrxq->tir->id;
 	if (mlx5_devx_cmd_modify_tir(hrxq->tir, &modify_tir)) {
drivers/net/mlx5/mlx5_flow.c +8 -2
index 45f2210ae7..572763decf 100644
@@ -2204,8 +2204,11 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev,
 	const char *message;
 	uint32_t queue_idx;
 
-	if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT &&
-	    rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ)
+	if (rss->func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+		DRV_LOG(WARNING, "port %u symmetric RSS supported with SORT",
+			dev->data->port_id);
+	} else if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT &&
+		   rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
 					  &rss->func,
@@ -5720,6 +5723,8 @@ get_meter_sub_policy(struct rte_eth_dev *dev,
 						items, rss_actions, error))
 					goto exit;
 				rss_desc_v[i] = wks->rss_desc;
+				rss_desc_v[i].symmetric_hash_function =
+						dev_flow.symmetri_hash_function;
 				rss_desc_v[i].key_len = MLX5_RSS_HASH_KEY_LEN;
 				rss_desc_v[i].hash_fields =
 						dev_flow.hash_fields;
@@ -7424,6 +7429,7 @@ flow_list_create(struct rte_eth_dev *dev, enum mlx5_flow_type type,
 		rss = flow_get_rss_action(dev, p_actions_rx);
 	if (rss) {
 		MLX5_ASSERT(rss->queue_num <= RTE_ETH_RSS_RETA_SIZE_512);
+		rss_desc->symmetric_hash_function = MLX5_RSS_IS_SYMM(rss->func);
 		/*
 		 * The following information is required by
 		 * mlx5_flow_hashfields_adjust() in advance.
drivers/net/mlx5/mlx5_flow.h +5 -0
index e273bd958d..e39afc47ad 100644
@@ -1003,6 +1003,7 @@ struct mlx5_flow {
 	bool external; /**< true if the flow is created external to PMD. */
 	uint8_t ingress:1; /**< 1 if the flow is ingress. */
 	uint8_t skip_scale:2;
+	uint8_t symmetri_hash_function:1;
 	/**
 	 * Each Bit be set to 1 if Skip the scale the flow group with factor.
 	 * If bit0 be set to 1, then skip the scale the original flow group;
@@ -1353,6 +1354,7 @@ struct mlx5_action_construct_data {
 			uint32_t mask[MLX5_ACT_MAX_MOD_FIELDS];
 		} modify_header;
 		struct {
+			bool symmetric_hash_function; /* Symmetric RSS hash */
 			uint64_t types; /* RSS hash types. */
 			uint32_t level; /* RSS level. */
 			uint32_t idx; /* Shared action index. */
@@ -1575,6 +1577,9 @@ struct rte_flow_template_table {
 				MLX5_RSS_HASH_ESP_SPI)
 #define MLX5_RSS_HASH_NONE 0ULL
 
+#define MLX5_RSS_IS_SYMM(func) \
+		((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ)
+
 
 /* extract next protocol type from Ethernet & VLAN headers */
 #define MLX5_ETHER_TYPE_FROM_HEADER(_s, _m, _itm, _prt) do { \
drivers/net/mlx5/mlx5_flow_dv.c +12 -1
index bae74fd383..ca2143c7cd 100644
@@ -12875,6 +12875,7 @@ flow_dv_hrxq_prepare(struct rte_eth_dev *dev,
 	struct mlx5_hrxq *hrxq;
 
 	MLX5_ASSERT(rss_desc->queue_num);
+	rss_desc->symmetric_hash_function = dev_flow->symmetri_hash_function;
 	rss_desc->key_len = MLX5_RSS_HASH_KEY_LEN;
 	rss_desc->hash_fields = dev_flow->hash_fields;
 	rss_desc->tunnel = !!(dh->layers & MLX5_FLOW_LAYER_TUNNEL);
@@ -13419,6 +13420,8 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,
 			const uint8_t *rss_key;
 
 			rss = sub_actions->conf;
+			rss_desc->symmetric_hash_function =
+				MLX5_RSS_IS_SYMM(rss->func);
 			memcpy(rss_desc->queue, rss->queue,
 			       rss->queue_num * sizeof(uint16_t));
 			rss_desc->queue_num = rss->queue_num;
@@ -15466,6 +15469,8 @@ flow_dv_translate(struct rte_eth_dev *dev,
 			break;
 		case RTE_FLOW_ACTION_TYPE_RSS:
 			rss = actions->conf;
+			rss_desc->symmetric_hash_function =
+				MLX5_RSS_IS_SYMM(rss->func);
 			memcpy(rss_desc->queue, rss->queue,
 			       rss->queue_num * sizeof(uint16_t));
 			rss_desc->queue_num = rss->queue_num;
@@ -15948,10 +15953,12 @@ flow_dv_translate(struct rte_eth_dev *dev,
 				      error);
 	if (ret)
 		return -rte_errno;
-	if (action_flags & MLX5_FLOW_ACTION_RSS)
+	if (action_flags & MLX5_FLOW_ACTION_RSS) {
+		dev_flow->symmetri_hash_function = rss_desc->symmetric_hash_function;
 		flow_dv_hashfields_set(dev_flow->handle->layers,
 				       rss_desc,
 				       &dev_flow->hash_fields);
+	}
 	/* If has RSS action in the sample action, the Sample/Mirror resource
 	 * should be registered after the hash filed be update.
 	 */
@@ -17029,6 +17036,8 @@ __flow_dv_action_rss_setup(struct rte_eth_dev *dev,
 					  "cannot setup indirection table");
 	memcpy(rss_desc.key, shared_rss->origin.key, MLX5_RSS_HASH_KEY_LEN);
 	rss_desc.key_len = MLX5_RSS_HASH_KEY_LEN;
+	rss_desc.symmetric_hash_function =
+		MLX5_RSS_IS_SYMM(shared_rss->origin.func);
 	rss_desc.const_q = shared_rss->origin.queue;
 	rss_desc.queue_num = shared_rss->origin.queue_num;
 	/* Set non-zero value to indicate a shared RSS. */
@@ -20153,6 +20162,8 @@ flow_dv_mtr_policy_rss_compare(const struct rte_flow_action_rss *r1,
 	if (!(r1->level <= 1 && r2->level <= 1) &&
 	    !(r1->level > 1 && r2->level > 1))
 		return 1;
+	if (r1->func != r2->func)
+		return 1;
 	if (r1->types != r2->types &&
 	    !((r1->types == 0 || r1->types == RTE_ETH_RSS_IP) &&
 	      (r2->types == 0 || r2->types == RTE_ETH_RSS_IP)))
drivers/net/mlx5/mlx5_flow_hw.c +7 -0
index 5e5ebbe620..3d2d240f43 100644
@@ -431,6 +431,7 @@ flow_hw_tir_action_register(struct rte_eth_dev *dev,
 		       MLX5_RSS_HASH_KEY_LEN);
 		rss_desc.key_len = MLX5_RSS_HASH_KEY_LEN;
 		rss_desc.types = !rss->types ? RTE_ETH_RSS_IP : rss->types;
+		rss_desc.symmetric_hash_function = MLX5_RSS_IS_SYMM(rss->func);
 		flow_hw_hashfields_set(&rss_desc, &rss_desc.hash_fields);
 		flow_dv_action_rss_l34_hash_adjust(rss->types,
 						   &rss_desc.hash_fields);
@@ -716,6 +717,8 @@ __flow_hw_act_data_shared_rss_append(struct mlx5_priv *priv,
 	act_data->shared_rss.types = !rss->origin.types ? RTE_ETH_RSS_IP :
 				     rss->origin.types;
 	act_data->shared_rss.idx = idx;
+	act_data->shared_rss.symmetric_hash_function =
+		MLX5_RSS_IS_SYMM(rss->origin.func);
 	LIST_INSERT_HEAD(&acts->act_list, act_data, next);
 	return 0;
 }
@@ -2217,6 +2220,7 @@ flow_hw_shared_action_get(struct rte_eth_dev *dev,
 	case MLX5_RTE_FLOW_ACTION_TYPE_RSS:
 		rss_desc.level = act_data->shared_rss.level;
 		rss_desc.types = act_data->shared_rss.types;
+		rss_desc.symmetric_hash_function = act_data->shared_rss.symmetric_hash_function;
 		flow_dv_hashfields_set(item_flags, &rss_desc, &hash_fields);
 		hrxq_idx = flow_dv_action_rss_hrxq_lookup
 			(dev, act_data->shared_rss.idx, hash_fields);
@@ -2304,6 +2308,9 @@ flow_hw_shared_action_construct(struct rte_eth_dev *dev, uint32_t queue,
 		act_data.shared_rss.types = !shared_rss->origin.types ?
 					    RTE_ETH_RSS_IP :
 					    shared_rss->origin.types;
+		act_data.shared_rss.symmetric_hash_function =
+			MLX5_RSS_IS_SYMM(shared_rss->origin.func);
+
 		item_flags = table->its[it_idx]->item_flags;
 		if (flow_hw_shared_action_get
 				(dev, &act_data, item_flags, rule_act))
drivers/net/mlx5/mlx5_rx.h +1 -1
index ff48194b9f..bc60dcaeb1 100644
@@ -282,7 +282,7 @@ uint64_t mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev);
 void mlx5_rxq_timestamp_set(struct rte_eth_dev *dev);
 int mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hxrq_idx,
 		     const uint8_t *rss_key, uint32_t rss_key_len,
-		     uint64_t hash_fields,
+		     uint64_t hash_fields, bool symmetric_hash_function,
 		     const uint16_t *queues, uint32_t queues_n);
 
 /* mlx5_rx.c */
drivers/net/mlx5/mlx5_rxq.c +5 -3
index 6e99c4dde4..77936d463a 100644
@@ -2759,6 +2759,7 @@ mlx5_hrxq_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry,
 	struct mlx5_hrxq *hrxq = container_of(entry, typeof(*hrxq), entry);
 
 	return (hrxq->rss_key_len != rss_desc->key_len ||
+	    hrxq->symmetric_hash_function != rss_desc->symmetric_hash_function ||
 	    memcmp(hrxq->rss_key, rss_desc->key, rss_desc->key_len) ||
 	    hrxq->hws_flags != rss_desc->hws_flags ||
 	    hrxq->hash_fields != rss_desc->hash_fields ||
@@ -2792,7 +2793,7 @@ mlx5_hrxq_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry,
 int
 mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx,
 		 const uint8_t *rss_key, uint32_t rss_key_len,
-		 uint64_t hash_fields,
+		 uint64_t hash_fields, bool symmetric_hash_function,
 		 const uint16_t *queues, uint32_t queues_n)
 {
 	int err;
@@ -2837,8 +2838,8 @@ mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx,
 		return -rte_errno;
 	}
 	MLX5_ASSERT(priv->obj_ops.hrxq_modify);
-	ret = priv->obj_ops.hrxq_modify(dev, hrxq, rss_key,
-					hash_fields, ind_tbl);
+	ret = priv->obj_ops.hrxq_modify(dev, hrxq, rss_key, hash_fields,
+					symmetric_hash_function, ind_tbl);
 	if (ret) {
 		rte_errno = errno;
 		goto error;
@@ -2938,6 +2939,7 @@ __mlx5_hrxq_create(struct rte_eth_dev *dev,
 	hrxq->rss_key_len = rss_key_len;
 	hrxq->hash_fields = rss_desc->hash_fields;
 	hrxq->hws_flags = rss_desc->hws_flags;
+	hrxq->symmetric_hash_function = rss_desc->symmetric_hash_function;
 	memcpy(hrxq->rss_key, rss_key, rss_key_len);
 	ret = priv->obj_ops.hrxq_new(dev, hrxq, rss_desc->tunnel);
 	if (ret < 0)
Signature · 1 line
2.18.1
#9 lore raw

PATCH 1/5 net/mlx5/hws: remove uneeded new line for DR_LOG

From: Alex Vesker <[email protected]>

In some places an extra new line was added, remove to have clean prints.

---
v2->v3
1. Right patches instead of wrong patches in the previous series v1->v2
1. Last patch in the series (net/mlx5/hws: support default miss action on FDB) needed some fixes to be properly rebased.

 drivers/net/mlx5/hws/mlx5dr_action.c  | 30 +++++++++++++--------------
 drivers/net/mlx5/hws/mlx5dr_cmd.c     |  2 +-
 drivers/net/mlx5/hws/mlx5dr_definer.c |  4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c |  4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +15 -15
index 01d30b8442..e2db85940c 100644
@@ -112,7 +112,7 @@ static int mlx5dr_action_get_shared_stc_nic(struct mlx5dr_context *ctx,
 		stc_attr.remove_words.num_of_words = MLX5DR_ACTION_HDR_LEN_L2_VLAN;
 		break;
 	default:
-		DR_LOG(ERR, "No such type : stc_type\n");
+		DR_LOG(ERR, "No such type : stc_type");
 		assert(false);
 		rte_errno = EINVAL;
 		goto unlock_and_out;
@@ -469,7 +469,7 @@ static uint32_t mlx5dr_action_get_mh_stc_type(__be64 pattern)
 		return MLX5_IFC_STC_ACTION_TYPE_COPY;
 	default:
 		assert(false);
-		DR_LOG(ERR, "Unsupported action type: 0x%x\n", action_type);
+		DR_LOG(ERR, "Unsupported action type: 0x%x", action_type);
 		rte_errno = ENOTSUP;
 		return MLX5_IFC_STC_ACTION_TYPE_NOP;
 	}
@@ -1017,7 +1017,7 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_cmd_query_ib_port(ctx->ibv_ctx, &vport_caps, ib_port_num);
 	if (ret) {
-		DR_LOG(ERR, "Failed querying port %d\n", ib_port_num);
+		DR_LOG(ERR, "Failed querying port %d", ib_port_num);
 		return ret;
 	}
 	action->vport.vport_num = vport_caps.vport_num;
@@ -1025,7 +1025,7 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for port %d\n", ib_port_num);
+		DR_LOG(ERR, "Failed creating stc for port %d", ib_port_num);
 		return ret;
 	}
 
@@ -1041,7 +1041,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
 	int ret;
 
 	if (!(flags & MLX5DR_ACTION_FLAG_HWS_FDB)) {
-		DR_LOG(ERR, "Vport action is supported for FDB only\n");
+		DR_LOG(ERR, "Vport action is supported for FDB only");
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -1052,7 +1052,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_dest_vport_hws(ctx, action, ib_port_num);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create vport action HWS\n");
+		DR_LOG(ERR, "Failed to create vport action HWS");
 		goto free_action;
 	}
 
@@ -1081,7 +1081,7 @@ mlx5dr_action_create_push_vlan(struct mlx5dr_context *ctx, uint32_t flags)
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for push vlan\n");
+		DR_LOG(ERR, "Failed creating stc for push vlan");
 		goto free_action;
 	}
 
@@ -1115,7 +1115,7 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags)
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for pop vlan\n");
+		DR_LOG(ERR, "Failed creating stc for pop vlan");
 		goto free_shared;
 	}
 
@@ -1418,7 +1418,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_context *ctx,
 
 	if (data_sz != MLX5DR_ACTION_HDR_LEN_L2 &&
 	    data_sz != MLX5DR_ACTION_HDR_LEN_L2_W_VLAN) {
-		DR_LOG(ERR, "Data size is not supported for decap-l3\n");
+		DR_LOG(ERR, "Data size is not supported for decap-l3");
 		rte_errno = EINVAL;
 		return rte_errno;
 	}
@@ -1430,7 +1430,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_context *ctx,
 	ret = mlx5dr_pat_arg_create_modify_header(ctx, action, mh_data_size,
 						  (__be64 *)mh_data, bulk_size);
 	if (ret) {
-		DR_LOG(ERR, "Failed allocating modify-header for decap-l3\n");
+		DR_LOG(ERR, "Failed allocating modify-header for decap-l3");
 		return ret;
 	}
 
@@ -1528,7 +1528,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
 
 	if (!mlx5dr_action_is_hws_flags(flags) ||
 	    ((flags & MLX5DR_ACTION_FLAG_SHARED) && log_bulk_size)) {
-		DR_LOG(ERR, "Reformat flags don't fit HWS (flags: %x0x)\n",
+		DR_LOG(ERR, "Reformat flags don't fit HWS (flags: %x0x)",
 			flags);
 		rte_errno = EINVAL;
 		goto free_action;
@@ -1536,7 +1536,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_reformat_hws(ctx, data_sz, inline_data, log_bulk_size, action);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create reformat.\n");
+		DR_LOG(ERR, "Failed to create reformat.");
 		rte_errno = EINVAL;
 		goto free_action;
 	}
@@ -1605,14 +1605,14 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 
 	if (!mlx5dr_action_is_hws_flags(flags) ||
 	    ((flags & MLX5DR_ACTION_FLAG_SHARED) && log_bulk_size)) {
-		DR_LOG(ERR, "Flags don't fit hws (flags: %x0x, log_bulk_size: %d)\n",
+		DR_LOG(ERR, "Flags don't fit hws (flags: %x0x, log_bulk_size: %d)",
 			flags, log_bulk_size);
 		rte_errno = EINVAL;
 		goto free_action;
 	}
 
 	if (!mlx5dr_pat_arg_verify_actions(pattern, pattern_sz / MLX5DR_MODIFY_ACTION_SIZE)) {
-		DR_LOG(ERR, "One of the actions is not supported\n");
+		DR_LOG(ERR, "One of the actions is not supported");
 		rte_errno = EINVAL;
 		goto free_action;
 	}
@@ -1628,7 +1628,7 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 		ret = mlx5dr_pat_arg_create_modify_header(ctx, action, pattern_sz,
 							  pattern, log_bulk_size);
 		if (ret) {
-			DR_LOG(ERR, "Failed allocating modify-header\n");
+			DR_LOG(ERR, "Failed allocating modify-header");
 			goto free_action;
 		}
 	}
drivers/net/mlx5/hws/mlx5dr_cmd.c +1 -1
index f1ae256a7e..f9f220cc6a 100644
@@ -1134,7 +1134,7 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 
 		ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 		if (ret) {
-			DR_LOG(ERR, "Query eswitch capabilities failed %d\n", ret);
+			DR_LOG(ERR, "Query eswitch capabilities failed %d", ret);
 			rte_errno = errno;
 			return rte_errno;
 		}
drivers/net/mlx5/hws/mlx5dr_definer.c +2 -2
index 7b01f4c9ec..33d0f2d18e 100644
@@ -535,7 +535,7 @@ mlx5dr_definer_get_mpls_fc(struct mlx5dr_definer_conv_data *cd, bool inner)
 		break;
 	default:
 		rte_errno = ENOTSUP;
-		DR_LOG(ERR, "MPLS index %d is not supported\n", mpls_idx);
+		DR_LOG(ERR, "MPLS index %d is not supported", mpls_idx);
 		return NULL;
 	}
 
@@ -571,7 +571,7 @@ mlx5dr_definer_get_mpls_oks_fc(struct mlx5dr_definer_conv_data *cd, bool inner)
 		break;
 	default:
 		rte_errno = ENOTSUP;
-		DR_LOG(ERR, "MPLS index %d is not supported\n", mpls_idx);
+		DR_LOG(ERR, "MPLS index %d is not supported", mpls_idx);
 		return NULL;
 	}
 
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +2 -2
index 830bc08678..bedaedb677 100644
@@ -449,7 +449,7 @@ bool mlx5dr_pat_arg_verify_actions(__be64 pattern[], uint16_t num_of_actions)
 		u8 action_id =
 			MLX5_GET(set_action_in, &pattern[i], action_type);
 		if (action_id >= MLX5_MODIFICATION_TYPE_MAX) {
-			DR_LOG(ERR, "Invalid action %u\n", action_id);
+			DR_LOG(ERR, "Invalid action %u", action_id);
 			return false;
 		}
 	}
@@ -468,7 +468,7 @@ int mlx5dr_pat_arg_create_modify_header(struct mlx5dr_context *ctx,
 
 	num_of_actions = pattern_sz / MLX5DR_MODIFY_ACTION_SIZE;
 	if (num_of_actions == 0) {
-		DR_LOG(ERR, "Invalid number of actions %u\n", num_of_actions);
+		DR_LOG(ERR, "Invalid number of actions %u", num_of_actions);
 		rte_errno = EINVAL;
 		return rte_errno;
 	}
Signature · 1 line
2.18.1
#10 lore raw

PATCH 2/5 net/mlx5/hws: allow destroying rule resources on error

From: Alex Vesker <[email protected]>

In case the send engine is in error state API should provide a way to free rule resources and provide a fake completion. Otherwise there is no way to release these resources.

---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +5 -5
index 071e1ad769..931c68b160 100644
@@ -521,6 +521,11 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 
 	queue = &ctx->send_queue[attr->queue_id];
 
+	if (unlikely(mlx5dr_send_engine_err(queue))) {
+		mlx5dr_rule_destroy_failed_hws(rule, attr);
+		return 0;
+	}
+
 	/* Rule is not completed yet */
 	if (rule->status == MLX5DR_RULE_STATUS_CREATING) {
 		rte_errno = EBUSY;
@@ -533,11 +538,6 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 		return 0;
 	}
 
-	if (unlikely(mlx5dr_send_engine_err(queue))) {
-		mlx5dr_rule_destroy_failed_hws(rule, attr);
-		return 0;
-	}
-
 	mlx5dr_send_engine_inc_rule(queue);
 
 	/* Send dependent WQE */
Signature · 1 line
2.18.1
#11 lore raw

PATCH 3/5 net/mlx5/hws: remove duplicated reformat type

In reply to Itamar Gozlan

From: Shun Hao <[email protected]>

Currently there are two enum definitions for reformat type:
mlx5dr_action_reformat_type and mlx5dr_action_type. They are actually the same. This patch remove the unnecessary mlx5dr_action_reformat_type so use only one definition for reformat type.

---
 drivers/net/mlx5/hws/mlx5dr.h         |  19 ++---
 drivers/net/mlx5/hws/mlx5dr_action.c  | 110 ++++++++++----------------
 drivers/net/mlx5/hws/mlx5dr_debug.c   |   8 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c |   2 +-
 drivers/net/mlx5/mlx5_flow_hw.c       |  34 ++++----
 5 files changed, 68 insertions(+), 105 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +6 -13
index 7942fb0a8f..7d5af4c9bb 100644
@@ -29,10 +29,10 @@ enum mlx5dr_matcher_resource_mode {
 
 enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_LAST,
-	MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
-	MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	MLX5DR_ACTION_TYP_TNL_L3_TO_L2,
-	MLX5DR_ACTION_TYP_L2_TO_TNL_L3,
+	MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3,
 	MLX5DR_ACTION_TYP_DROP,
 	MLX5DR_ACTION_TYP_TIR,
 	MLX5DR_ACTION_TYP_FT,
@@ -62,13 +62,6 @@ enum mlx5dr_action_flags {
 	MLX5DR_ACTION_FLAG_SHARED = 1 << 6,
 };
 
-enum mlx5dr_action_reformat_type {
-	MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3,
-};
-
 enum mlx5dr_action_aso_meter_color {
 	MLX5DR_ACTION_ASO_METER_COLOR_RED = 0x0,
 	MLX5DR_ACTION_ASO_METER_COLOR_YELLOW = 0x1,
@@ -487,7 +480,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
  * @param[in] ctx
  *	The context in which the new action will be created.
  * @param[in] reformat_type
- *	Type of reformat.
+ *	Type of reformat prefixed with MLX5DR_ACTION_TYP_REFORMAT.
  * @param[in] data_sz
  *	Size in bytes of data.
  * @param[in] inline_data
@@ -500,7 +493,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
  */
 struct mlx5dr_action *
 mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
-			      enum mlx5dr_action_reformat_type reformat_type,
+			      enum mlx5dr_action_type reformat_type,
 			      size_t data_sz,
 			      void *inline_data,
 			      uint32_t log_bulk_size,
drivers/net/mlx5/hws/mlx5dr_action.c +40 -70

267 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_debug.c +4 -4
index d249f8d869..5064b23b7d 100644
@@ -6,10 +6,10 @@
 
 const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_LAST] = "LAST",
-	[MLX5DR_ACTION_TYP_TNL_L2_TO_L2] = "TNL_L2_TO_L2",
-	[MLX5DR_ACTION_TYP_L2_TO_TNL_L2] = "L2_TO_TNL_L2",
-	[MLX5DR_ACTION_TYP_TNL_L3_TO_L2] = "TNL_L3_TO_L2",
-	[MLX5DR_ACTION_TYP_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
+	[MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2] = "TNL_L2_TO_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2] = "L2_TO_TNL_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2] = "TNL_L3_TO_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
 	[MLX5DR_ACTION_TYP_DROP] = "DROP",
 	[MLX5DR_ACTION_TYP_TIR] = "TIR",
 	[MLX5DR_ACTION_TYP_FT] = "FT",
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +1 -1
index bedaedb677..309a61d477 100644
@@ -73,7 +73,7 @@ static bool mlx5dr_pat_compare_pattern(enum mlx5dr_action_type cur_type,
 		return false;
 
 	 /* All decap-l3 look the same, only change is the num of actions */
-	if (type == MLX5DR_ACTION_TYP_TNL_L3_TO_L2)
+	if (type == MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2)
 		return true;
 
 	for (i = 0; i < num_of_actions; i++) {
drivers/net/mlx5/mlx5_flow_hw.c +17 -17
index 330386df77..e1adc081c1 100644
@@ -1420,7 +1420,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 	struct rte_flow_action *actions = at->actions;
 	struct rte_flow_action *action_start = actions;
 	struct rte_flow_action *masks = at->masks;
-	enum mlx5dr_action_reformat_type refmt_type = 0;
+	enum mlx5dr_action_type refmt_type = 0;
 	const struct rte_flow_action_raw_encap *raw_encap_data;
 	const struct rte_flow_item *enc_item = NULL, *enc_item_m = NULL;
 	uint16_t reformat_src = 0;
@@ -1575,7 +1575,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 					     masks->conf)->definition;
 			reformat_used = true;
 			reformat_src = actions - action_start;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 			MLX5_ASSERT(!reformat_used);
@@ -1586,13 +1586,13 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 					     masks->conf)->definition;
 			reformat_used = true;
 			reformat_src = actions - action_start;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
 			MLX5_ASSERT(!reformat_used);
 			reformat_used = true;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			raw_encap_data =
@@ -1608,18 +1608,18 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 			if (reformat_used) {
 				refmt_type = data_size <
 				MLX5_ENCAPSULATION_DECISION_SIZE ?
-				MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2 :
-				MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3;
+				MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :
+				MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
 			} else {
 				reformat_used = true;
 				refmt_type =
-				MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+				MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			}
 			reformat_src = actions - action_start;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 			reformat_used = true;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
 			flow_hw_translate_group(dev, cfg, attr->group,
@@ -4523,10 +4523,10 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR,
-	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	[RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
-	[RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
+	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	[RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
+	[RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
 	[RTE_FLOW_ACTION_TYPE_MODIFY_FIELD] = MLX5DR_ACTION_TYP_MODIFY_HDR,
 	[RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = MLX5DR_ACTION_TYP_VPORT,
 	[RTE_FLOW_ACTION_TYPE_CONNTRACK] = MLX5DR_ACTION_TYP_ASO_CT,
@@ -4604,7 +4604,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 	enum mlx5dr_action_type action_types[MLX5_HW_MAX_ACTS] = { MLX5DR_ACTION_TYP_LAST };
 	unsigned int i;
 	uint16_t curr_off;
-	enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
+	enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 	uint16_t reformat_off = UINT16_MAX;
 	uint16_t mhdr_off = UINT16_MAX;
 	uint16_t cnt_off = UINT16_MAX;
@@ -4642,16 +4642,16 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 			data_size = raw_encap_data->size;
 			if (reformat_off != UINT16_MAX) {
 				reformat_act_type = data_size < MLX5_ENCAPSULATION_DECISION_SIZE ?
-					MLX5DR_ACTION_TYP_TNL_L3_TO_L2 :
-					MLX5DR_ACTION_TYP_L2_TO_TNL_L3;
+					MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :
+					MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
 			} else {
 				reformat_off = curr_off++;
-				reformat_act_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2;
+				reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			}
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 			reformat_off = curr_off++;
-			reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
+			reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
 			if (mhdr_off == UINT16_MAX) {
Signature · 1 line
2.18.1
#12 lore raw

PATCH 4/5 net/mlx5/hws: renaming FT to TBL

In reply to Itamar Gozlan

An action naming change is made to describe the action better and avoid implicit meaning.

---
 drivers/net/mlx5/hws/mlx5dr.h        |  2 +-
 drivers/net/mlx5/hws/mlx5dr_action.c | 16 ++++++++--------
 drivers/net/mlx5/hws/mlx5dr_debug.c  |  2 +-
 drivers/net/mlx5/mlx5_flow_hw.c      |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +1 -1
index 7d5af4c9bb..ec2230d136 100644
@@ -35,7 +35,7 @@ enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3,
 	MLX5DR_ACTION_TYP_DROP,
 	MLX5DR_ACTION_TYP_TIR,
-	MLX5DR_ACTION_TYP_FT,
+	MLX5DR_ACTION_TYP_TBL,
 	MLX5DR_ACTION_TYP_CTR,
 	MLX5DR_ACTION_TYP_TAG,
 	MLX5DR_ACTION_TYP_MODIFY_HDR,
drivers/net/mlx5/hws/mlx5dr_action.c +8 -8
index 851cee8802..74f4e60863 100644
@@ -30,7 +30,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_TIR) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -48,7 +48,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
 		BIT(MLX5DR_ACTION_TYP_DEST_ROOT),
@@ -67,7 +67,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_VPORT) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -275,7 +275,7 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 		action = rule_actions[i].action;
 
 		switch (action->type) {
-		case MLX5DR_ACTION_TYP_FT:
+		case MLX5DR_ACTION_TYP_TBL:
 		case MLX5DR_ACTION_TYP_TIR:
 			attr[i].type = MLX5DV_FLOW_ACTION_DEST_DEVX;
 			attr[i].obj = action->devx_obj;
@@ -519,7 +519,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 			attr->modify_header.pattern_id = action->modify_header.pattern_obj->id;
 		}
 		break;
-	case MLX5DR_ACTION_TYP_FT:
+	case MLX5DR_ACTION_TYP_TBL:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_FT;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
 		attr->dest_table_id = obj->id;
@@ -747,7 +747,7 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx,
 		return NULL;
 	}
 
-	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_FT);
+	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_TBL);
 	if (!action)
 		return NULL;
 
@@ -1681,7 +1681,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
 	case MLX5DR_ACTION_TYP_TAG:
 	case MLX5DR_ACTION_TYP_DROP:
 	case MLX5DR_ACTION_TYP_CTR:
-	case MLX5DR_ACTION_TYP_FT:
+	case MLX5DR_ACTION_TYP_TBL:
 	case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
 	case MLX5DR_ACTION_TYP_ASO_METER:
 	case MLX5DR_ACTION_TYP_ASO_CT:
@@ -2178,7 +2178,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
 		switch (action_type[i]) {
 		case MLX5DR_ACTION_TYP_DROP:
 		case MLX5DR_ACTION_TYP_TIR:
-		case MLX5DR_ACTION_TYP_FT:
+		case MLX5DR_ACTION_TYP_TBL:
 		case MLX5DR_ACTION_TYP_DEST_ROOT:
 		case MLX5DR_ACTION_TYP_VPORT:
 		case MLX5DR_ACTION_TYP_MISS:
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -1
index 5064b23b7d..48810142a0 100644
@@ -12,7 +12,7 @@ const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
 	[MLX5DR_ACTION_TYP_DROP] = "DROP",
 	[MLX5DR_ACTION_TYP_TIR] = "TIR",
-	[MLX5DR_ACTION_TYP_FT] = "FT",
+	[MLX5DR_ACTION_TYP_TBL] = "TBL",
 	[MLX5DR_ACTION_TYP_CTR] = "CTR",
 	[MLX5DR_ACTION_TYP_TAG] = "TAG",
 	[MLX5DR_ACTION_TYP_MODIFY_HDR] = "MODIFY_HDR",
drivers/net/mlx5/mlx5_flow_hw.c +2 -2
index e1adc081c1..521df9ff40 100644
@@ -4520,7 +4520,7 @@ flow_hw_actions_validate(struct rte_eth_dev *dev,
 static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_MARK] = MLX5DR_ACTION_TYP_TAG,
 	[RTE_FLOW_ACTION_TYPE_DROP] = MLX5DR_ACTION_TYP_DROP,
-	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT,
+	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_TBL,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
@@ -4665,7 +4665,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 			action_types[curr_off++] = MLX5DR_ACTION_TYP_ASO_METER;
 			if (curr_off >= MLX5_HW_MAX_ACTS)
 				goto err_actions_num;
-			action_types[curr_off++] = MLX5DR_ACTION_TYP_FT;
+			action_types[curr_off++] = MLX5DR_ACTION_TYP_TBL;
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
 			type = mlx5_hw_dr_action_types[at->actions[i].type];
Signature · 1 line
2.18.1
#13 lore raw

PATCH 5/5 net/mlx5/hws: support default miss action on FDB

In reply to Itamar Gozlan

From: Alex Vesker <[email protected]>

Add the support for default miss on HWS FDB, this implementation was missing until now. Default miss can be used for more efficient miss flow instead of going to an empty matcher or some defecated empty table.

---
 drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
 drivers/net/mlx5/hws/mlx5dr_table.c  |  6 +-----
 2 files changed, 21 insertions(+), 12 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +20 -7
index 74f4e60863..920099ba5b 100644
@@ -322,10 +322,12 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 	return 0;
 }
 
-static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
-					 struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
-					 enum mlx5dr_table_type table_type,
-					 bool is_mirror)
+static bool
+mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
+			     struct mlx5dr_cmd_stc_modify_attr *stc_attr,
+			     struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
+			     enum mlx5dr_table_type table_type,
+			     bool is_mirror)
 {
 	struct mlx5dr_devx_obj *devx_obj;
 	bool use_fixup = false;
@@ -348,6 +350,17 @@ static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_
 		use_fixup = true;
 		break;
 
+	case MLX5_IFC_STC_ACTION_TYPE_ALLOW:
+		if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
+			fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT;
+			fixup_stc_attr->action_offset = stc_attr->action_offset;
+			fixup_stc_attr->stc_offset = stc_attr->stc_offset;
+			fixup_stc_attr->vport.esw_owner_vhca_id = ctx->caps->vhca_id;
+			fixup_stc_attr->vport.vport_num = ctx->caps->eswitch_manager_vport_number;
+			use_fixup = true;
+		}
+		break;
+
 	case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT:
 		if (stc_attr->vport.vport_num != WIRE_PORT)
 			break;
@@ -397,7 +410,7 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 	devx_obj_0 = mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
 
 	/* According to table/action limitation change the stc_attr */
-	use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr, table_type, false);
+	use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr, &fixup_stc_attr, table_type, false);
 	ret = mlx5dr_cmd_stc_modify(devx_obj_0, use_fixup ? &fixup_stc_attr : stc_attr);
 	if (ret) {
 		DR_LOG(ERR, "Failed to modify STC action_type %d tbl_type %d",
@@ -411,7 +424,8 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 
 		devx_obj_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(stc_pool, stc);
 
-		use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr,
+		use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr,
+							 &fixup_stc_attr,
 							 table_type, true);
 		ret = mlx5dr_cmd_stc_modify(devx_obj_1, use_fixup ? &fixup_stc_attr : stc_attr);
 		if (ret) {
@@ -491,7 +505,6 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 	case MLX5DR_ACTION_TYP_MISS:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_ALLOW;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
-		/* TODO Need to support default miss for FDB */
 		break;
 	case MLX5DR_ACTION_TYP_CTR:
 		attr->id = obj->id;
drivers/net/mlx5/hws/mlx5dr_table.c +1 -5
index c18ee7c552..f91f04d924 100644
@@ -24,7 +24,6 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	struct mlx5dr_cmd_forward_tbl *default_miss;
 	struct mlx5dr_context *ctx = tbl->ctx;
 	uint8_t tbl_type = tbl->type;
-	uint32_t vport;
 
 	if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
 		return 0;
@@ -38,12 +37,9 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	ft_attr.level = tbl->ctx->caps->fdb_ft.max_level; /* The last level */
 	ft_attr.rtc_valid = false;
 
-	assert(ctx->caps->eswitch_manager);
-	vport = ctx->caps->eswitch_manager_vport_number;
-
 	fte_attr.action_flags = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 	fte_attr.destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-	fte_attr.destination_id = vport;
+	fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number;
 
 	default_miss = mlx5dr_cmd_forward_tbl_create(mlx5dr_context_get_local_ibv(ctx),
 						     &ft_attr, &fte_attr);
Signature · 1 line
2.18.1
#14 lore raw

PATCH v3 1/5 net/mlx5/hws: remove unneeded new line for DR_LOG

From: Alex Vesker <[email protected]>

In some places an extra new line was added, remove to have clean prints.

---
v1 -> v3
(1) amending a wrong subject prefix send (v1 instead of v3).
(2) typo fix (uneeded -> unneeded)
v2->v3
1. Right patches instead of wrong patches in the previous series v1->v2
1. Last patch in the series (net/mlx5/hws: support default miss action on FDB) needed some fixes to be properly rebased

 drivers/net/mlx5/hws/mlx5dr_action.c  | 30 +++++++++++++--------------
 drivers/net/mlx5/hws/mlx5dr_cmd.c     |  2 +-
 drivers/net/mlx5/hws/mlx5dr_definer.c |  4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c |  4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +15 -15
index 01d30b8442..e2db85940c 100644
@@ -112,7 +112,7 @@ static int mlx5dr_action_get_shared_stc_nic(struct mlx5dr_context *ctx,
 		stc_attr.remove_words.num_of_words = MLX5DR_ACTION_HDR_LEN_L2_VLAN;
 		break;
 	default:
-		DR_LOG(ERR, "No such type : stc_type\n");
+		DR_LOG(ERR, "No such type : stc_type");
 		assert(false);
 		rte_errno = EINVAL;
 		goto unlock_and_out;
@@ -469,7 +469,7 @@ static uint32_t mlx5dr_action_get_mh_stc_type(__be64 pattern)
 		return MLX5_IFC_STC_ACTION_TYPE_COPY;
 	default:
 		assert(false);
-		DR_LOG(ERR, "Unsupported action type: 0x%x\n", action_type);
+		DR_LOG(ERR, "Unsupported action type: 0x%x", action_type);
 		rte_errno = ENOTSUP;
 		return MLX5_IFC_STC_ACTION_TYPE_NOP;
 	}
@@ -1017,7 +1017,7 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_cmd_query_ib_port(ctx->ibv_ctx, &vport_caps, ib_port_num);
 	if (ret) {
-		DR_LOG(ERR, "Failed querying port %d\n", ib_port_num);
+		DR_LOG(ERR, "Failed querying port %d", ib_port_num);
 		return ret;
 	}
 	action->vport.vport_num = vport_caps.vport_num;
@@ -1025,7 +1025,7 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for port %d\n", ib_port_num);
+		DR_LOG(ERR, "Failed creating stc for port %d", ib_port_num);
 		return ret;
 	}
 
@@ -1041,7 +1041,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
 	int ret;
 
 	if (!(flags & MLX5DR_ACTION_FLAG_HWS_FDB)) {
-		DR_LOG(ERR, "Vport action is supported for FDB only\n");
+		DR_LOG(ERR, "Vport action is supported for FDB only");
 		rte_errno = EINVAL;
 		return NULL;
 	}
@@ -1052,7 +1052,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_dest_vport_hws(ctx, action, ib_port_num);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create vport action HWS\n");
+		DR_LOG(ERR, "Failed to create vport action HWS");
 		goto free_action;
 	}
 
@@ -1081,7 +1081,7 @@ mlx5dr_action_create_push_vlan(struct mlx5dr_context *ctx, uint32_t flags)
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for push vlan\n");
+		DR_LOG(ERR, "Failed creating stc for push vlan");
 		goto free_action;
 	}
 
@@ -1115,7 +1115,7 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags)
 
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
-		DR_LOG(ERR, "Failed creating stc for pop vlan\n");
+		DR_LOG(ERR, "Failed creating stc for pop vlan");
 		goto free_shared;
 	}
 
@@ -1418,7 +1418,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_context *ctx,
 
 	if (data_sz != MLX5DR_ACTION_HDR_LEN_L2 &&
 	    data_sz != MLX5DR_ACTION_HDR_LEN_L2_W_VLAN) {
-		DR_LOG(ERR, "Data size is not supported for decap-l3\n");
+		DR_LOG(ERR, "Data size is not supported for decap-l3");
 		rte_errno = EINVAL;
 		return rte_errno;
 	}
@@ -1430,7 +1430,7 @@ mlx5dr_action_handle_tunnel_l3_to_l2(struct mlx5dr_context *ctx,
 	ret = mlx5dr_pat_arg_create_modify_header(ctx, action, mh_data_size,
 						  (__be64 *)mh_data, bulk_size);
 	if (ret) {
-		DR_LOG(ERR, "Failed allocating modify-header for decap-l3\n");
+		DR_LOG(ERR, "Failed allocating modify-header for decap-l3");
 		return ret;
 	}
 
@@ -1528,7 +1528,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
 
 	if (!mlx5dr_action_is_hws_flags(flags) ||
 	    ((flags & MLX5DR_ACTION_FLAG_SHARED) && log_bulk_size)) {
-		DR_LOG(ERR, "Reformat flags don't fit HWS (flags: %x0x)\n",
+		DR_LOG(ERR, "Reformat flags don't fit HWS (flags: %x0x)",
 			flags);
 		rte_errno = EINVAL;
 		goto free_action;
@@ -1536,7 +1536,7 @@ mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
 
 	ret = mlx5dr_action_create_reformat_hws(ctx, data_sz, inline_data, log_bulk_size, action);
 	if (ret) {
-		DR_LOG(ERR, "Failed to create reformat.\n");
+		DR_LOG(ERR, "Failed to create reformat.");
 		rte_errno = EINVAL;
 		goto free_action;
 	}
@@ -1605,14 +1605,14 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 
 	if (!mlx5dr_action_is_hws_flags(flags) ||
 	    ((flags & MLX5DR_ACTION_FLAG_SHARED) && log_bulk_size)) {
-		DR_LOG(ERR, "Flags don't fit hws (flags: %x0x, log_bulk_size: %d)\n",
+		DR_LOG(ERR, "Flags don't fit hws (flags: %x0x, log_bulk_size: %d)",
 			flags, log_bulk_size);
 		rte_errno = EINVAL;
 		goto free_action;
 	}
 
 	if (!mlx5dr_pat_arg_verify_actions(pattern, pattern_sz / MLX5DR_MODIFY_ACTION_SIZE)) {
-		DR_LOG(ERR, "One of the actions is not supported\n");
+		DR_LOG(ERR, "One of the actions is not supported");
 		rte_errno = EINVAL;
 		goto free_action;
 	}
@@ -1628,7 +1628,7 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 		ret = mlx5dr_pat_arg_create_modify_header(ctx, action, pattern_sz,
 							  pattern, log_bulk_size);
 		if (ret) {
-			DR_LOG(ERR, "Failed allocating modify-header\n");
+			DR_LOG(ERR, "Failed allocating modify-header");
 			goto free_action;
 		}
 	}
drivers/net/mlx5/hws/mlx5dr_cmd.c +1 -1
index f1ae256a7e..f9f220cc6a 100644
@@ -1134,7 +1134,7 @@ int mlx5dr_cmd_query_caps(struct ibv_context *ctx,
 
 		ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 		if (ret) {
-			DR_LOG(ERR, "Query eswitch capabilities failed %d\n", ret);
+			DR_LOG(ERR, "Query eswitch capabilities failed %d", ret);
 			rte_errno = errno;
 			return rte_errno;
 		}
drivers/net/mlx5/hws/mlx5dr_definer.c +2 -2
index 7b01f4c9ec..33d0f2d18e 100644
@@ -535,7 +535,7 @@ mlx5dr_definer_get_mpls_fc(struct mlx5dr_definer_conv_data *cd, bool inner)
 		break;
 	default:
 		rte_errno = ENOTSUP;
-		DR_LOG(ERR, "MPLS index %d is not supported\n", mpls_idx);
+		DR_LOG(ERR, "MPLS index %d is not supported", mpls_idx);
 		return NULL;
 	}
 
@@ -571,7 +571,7 @@ mlx5dr_definer_get_mpls_oks_fc(struct mlx5dr_definer_conv_data *cd, bool inner)
 		break;
 	default:
 		rte_errno = ENOTSUP;
-		DR_LOG(ERR, "MPLS index %d is not supported\n", mpls_idx);
+		DR_LOG(ERR, "MPLS index %d is not supported", mpls_idx);
 		return NULL;
 	}
 
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +2 -2
index 830bc08678..bedaedb677 100644
@@ -449,7 +449,7 @@ bool mlx5dr_pat_arg_verify_actions(__be64 pattern[], uint16_t num_of_actions)
 		u8 action_id =
 			MLX5_GET(set_action_in, &pattern[i], action_type);
 		if (action_id >= MLX5_MODIFICATION_TYPE_MAX) {
-			DR_LOG(ERR, "Invalid action %u\n", action_id);
+			DR_LOG(ERR, "Invalid action %u", action_id);
 			return false;
 		}
 	}
@@ -468,7 +468,7 @@ int mlx5dr_pat_arg_create_modify_header(struct mlx5dr_context *ctx,
 
 	num_of_actions = pattern_sz / MLX5DR_MODIFY_ACTION_SIZE;
 	if (num_of_actions == 0) {
-		DR_LOG(ERR, "Invalid number of actions %u\n", num_of_actions);
+		DR_LOG(ERR, "Invalid number of actions %u", num_of_actions);
 		rte_errno = EINVAL;
 		return rte_errno;
 	}
Signature · 1 line
2.18.1
#15 lore raw

PATCH v3 2/5 net/mlx5/hws: allow destroying rule resources on error

From: Alex Vesker <[email protected]>

In case the send engine is in error state API should provide a way to free rule resources and provide a fake completion. Otherwise there is no way to release these resources.

---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/mlx5/hws/mlx5dr_rule.c +5 -5
index 071e1ad769..931c68b160 100644
@@ -521,6 +521,11 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 
 	queue = &ctx->send_queue[attr->queue_id];
 
+	if (unlikely(mlx5dr_send_engine_err(queue))) {
+		mlx5dr_rule_destroy_failed_hws(rule, attr);
+		return 0;
+	}
+
 	/* Rule is not completed yet */
 	if (rule->status == MLX5DR_RULE_STATUS_CREATING) {
 		rte_errno = EBUSY;
@@ -533,11 +538,6 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 		return 0;
 	}
 
-	if (unlikely(mlx5dr_send_engine_err(queue))) {
-		mlx5dr_rule_destroy_failed_hws(rule, attr);
-		return 0;
-	}
-
 	mlx5dr_send_engine_inc_rule(queue);
 
 	/* Send dependent WQE */
Signature · 1 line
2.18.1
#16 lore raw

PATCH v3 3/5 net/mlx5/hws: remove duplicated reformat type

In reply to Itamar Gozlan

From: Shun Hao <[email protected]>

Currently there are two enum definitions for reformat type:
mlx5dr_action_reformat_type and mlx5dr_action_type. They are actually the same. This patch remove the unnecessary mlx5dr_action_reformat_type so use only one definition for reformat type.

---
 drivers/net/mlx5/hws/mlx5dr.h         |  19 ++---
 drivers/net/mlx5/hws/mlx5dr_action.c  | 110 ++++++++++----------------
 drivers/net/mlx5/hws/mlx5dr_debug.c   |   8 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c |   2 +-
 drivers/net/mlx5/mlx5_flow_hw.c       |  34 ++++----
 5 files changed, 68 insertions(+), 105 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +6 -13
index 7942fb0a8f..7d5af4c9bb 100644
@@ -29,10 +29,10 @@ enum mlx5dr_matcher_resource_mode {
 
 enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_LAST,
-	MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
-	MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	MLX5DR_ACTION_TYP_TNL_L3_TO_L2,
-	MLX5DR_ACTION_TYP_L2_TO_TNL_L3,
+	MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2,
+	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3,
 	MLX5DR_ACTION_TYP_DROP,
 	MLX5DR_ACTION_TYP_TIR,
 	MLX5DR_ACTION_TYP_FT,
@@ -62,13 +62,6 @@ enum mlx5dr_action_flags {
 	MLX5DR_ACTION_FLAG_SHARED = 1 << 6,
 };
 
-enum mlx5dr_action_reformat_type {
-	MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2,
-	MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3,
-};
-
 enum mlx5dr_action_aso_meter_color {
 	MLX5DR_ACTION_ASO_METER_COLOR_RED = 0x0,
 	MLX5DR_ACTION_ASO_METER_COLOR_YELLOW = 0x1,
@@ -487,7 +480,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
  * @param[in] ctx
  *	The context in which the new action will be created.
  * @param[in] reformat_type
- *	Type of reformat.
+ *	Type of reformat prefixed with MLX5DR_ACTION_TYP_REFORMAT.
  * @param[in] data_sz
  *	Size in bytes of data.
  * @param[in] inline_data
@@ -500,7 +493,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
  */
 struct mlx5dr_action *
 mlx5dr_action_create_reformat(struct mlx5dr_context *ctx,
-			      enum mlx5dr_action_reformat_type reformat_type,
+			      enum mlx5dr_action_type reformat_type,
 			      size_t data_sz,
 			      void *inline_data,
 			      uint32_t log_bulk_size,
drivers/net/mlx5/hws/mlx5dr_action.c +40 -70

267 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_debug.c +4 -4
index d249f8d869..5064b23b7d 100644
@@ -6,10 +6,10 @@
 
 const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_LAST] = "LAST",
-	[MLX5DR_ACTION_TYP_TNL_L2_TO_L2] = "TNL_L2_TO_L2",
-	[MLX5DR_ACTION_TYP_L2_TO_TNL_L2] = "L2_TO_TNL_L2",
-	[MLX5DR_ACTION_TYP_TNL_L3_TO_L2] = "TNL_L3_TO_L2",
-	[MLX5DR_ACTION_TYP_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
+	[MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2] = "TNL_L2_TO_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2] = "L2_TO_TNL_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2] = "TNL_L3_TO_L2",
+	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
 	[MLX5DR_ACTION_TYP_DROP] = "DROP",
 	[MLX5DR_ACTION_TYP_TIR] = "TIR",
 	[MLX5DR_ACTION_TYP_FT] = "FT",
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +1 -1
index bedaedb677..309a61d477 100644
@@ -73,7 +73,7 @@ static bool mlx5dr_pat_compare_pattern(enum mlx5dr_action_type cur_type,
 		return false;
 
 	 /* All decap-l3 look the same, only change is the num of actions */
-	if (type == MLX5DR_ACTION_TYP_TNL_L3_TO_L2)
+	if (type == MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2)
 		return true;
 
 	for (i = 0; i < num_of_actions; i++) {
drivers/net/mlx5/mlx5_flow_hw.c +17 -17
index 330386df77..e1adc081c1 100644
@@ -1420,7 +1420,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 	struct rte_flow_action *actions = at->actions;
 	struct rte_flow_action *action_start = actions;
 	struct rte_flow_action *masks = at->masks;
-	enum mlx5dr_action_reformat_type refmt_type = 0;
+	enum mlx5dr_action_type refmt_type = 0;
 	const struct rte_flow_action_raw_encap *raw_encap_data;
 	const struct rte_flow_item *enc_item = NULL, *enc_item_m = NULL;
 	uint16_t reformat_src = 0;
@@ -1575,7 +1575,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 					     masks->conf)->definition;
 			reformat_used = true;
 			reformat_src = actions - action_start;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 			MLX5_ASSERT(!reformat_used);
@@ -1586,13 +1586,13 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 					     masks->conf)->definition;
 			reformat_used = true;
 			reformat_src = actions - action_start;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
 		case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
 			MLX5_ASSERT(!reformat_used);
 			reformat_used = true;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			raw_encap_data =
@@ -1608,18 +1608,18 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 			if (reformat_used) {
 				refmt_type = data_size <
 				MLX5_ENCAPSULATION_DECISION_SIZE ?
-				MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2 :
-				MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3;
+				MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :
+				MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
 			} else {
 				reformat_used = true;
 				refmt_type =
-				MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2;
+				MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			}
 			reformat_src = actions - action_start;
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 			reformat_used = true;
-			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
+			refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
 			flow_hw_translate_group(dev, cfg, attr->group,
@@ -4523,10 +4523,10 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR,
-	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	[RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2,
-	[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
-	[RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2,
+	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	[RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
+	[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
+	[RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2,
 	[RTE_FLOW_ACTION_TYPE_MODIFY_FIELD] = MLX5DR_ACTION_TYP_MODIFY_HDR,
 	[RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = MLX5DR_ACTION_TYP_VPORT,
 	[RTE_FLOW_ACTION_TYPE_CONNTRACK] = MLX5DR_ACTION_TYP_ASO_CT,
@@ -4604,7 +4604,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 	enum mlx5dr_action_type action_types[MLX5_HW_MAX_ACTS] = { MLX5DR_ACTION_TYP_LAST };
 	unsigned int i;
 	uint16_t curr_off;
-	enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
+	enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 	uint16_t reformat_off = UINT16_MAX;
 	uint16_t mhdr_off = UINT16_MAX;
 	uint16_t cnt_off = UINT16_MAX;
@@ -4642,16 +4642,16 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 			data_size = raw_encap_data->size;
 			if (reformat_off != UINT16_MAX) {
 				reformat_act_type = data_size < MLX5_ENCAPSULATION_DECISION_SIZE ?
-					MLX5DR_ACTION_TYP_TNL_L3_TO_L2 :
-					MLX5DR_ACTION_TYP_L2_TO_TNL_L3;
+					MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 :
+					MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
 			} else {
 				reformat_off = curr_off++;
-				reformat_act_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2;
+				reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
 			}
 			break;
 		case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
 			reformat_off = curr_off++;
-			reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
+			reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
 			if (mhdr_off == UINT16_MAX) {
Signature · 1 line
2.18.1
#17 lore raw

PATCH v3 4/5 net/mlx5/hws: renaming FT to TBL

In reply to Itamar Gozlan

An action naming change is made to describe the action better and avoid implicit meaning.

---
 drivers/net/mlx5/hws/mlx5dr.h        |  2 +-
 drivers/net/mlx5/hws/mlx5dr_action.c | 16 ++++++++--------
 drivers/net/mlx5/hws/mlx5dr_debug.c  |  2 +-
 drivers/net/mlx5/mlx5_flow_hw.c      |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +1 -1
index 7d5af4c9bb..ec2230d136 100644
@@ -35,7 +35,7 @@ enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3,
 	MLX5DR_ACTION_TYP_DROP,
 	MLX5DR_ACTION_TYP_TIR,
-	MLX5DR_ACTION_TYP_FT,
+	MLX5DR_ACTION_TYP_TBL,
 	MLX5DR_ACTION_TYP_CTR,
 	MLX5DR_ACTION_TYP_TAG,
 	MLX5DR_ACTION_TYP_MODIFY_HDR,
drivers/net/mlx5/hws/mlx5dr_action.c +8 -8
index 851cee8802..74f4e60863 100644
@@ -30,7 +30,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_TIR) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -48,7 +48,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
 		BIT(MLX5DR_ACTION_TYP_DEST_ROOT),
@@ -67,7 +67,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) |
 		BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3),
-		BIT(MLX5DR_ACTION_TYP_FT) |
+		BIT(MLX5DR_ACTION_TYP_TBL) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_VPORT) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -275,7 +275,7 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 		action = rule_actions[i].action;
 
 		switch (action->type) {
-		case MLX5DR_ACTION_TYP_FT:
+		case MLX5DR_ACTION_TYP_TBL:
 		case MLX5DR_ACTION_TYP_TIR:
 			attr[i].type = MLX5DV_FLOW_ACTION_DEST_DEVX;
 			attr[i].obj = action->devx_obj;
@@ -519,7 +519,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 			attr->modify_header.pattern_id = action->modify_header.pattern_obj->id;
 		}
 		break;
-	case MLX5DR_ACTION_TYP_FT:
+	case MLX5DR_ACTION_TYP_TBL:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_FT;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
 		attr->dest_table_id = obj->id;
@@ -747,7 +747,7 @@ mlx5dr_action_create_dest_table(struct mlx5dr_context *ctx,
 		return NULL;
 	}
 
-	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_FT);
+	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_TBL);
 	if (!action)
 		return NULL;
 
@@ -1681,7 +1681,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
 	case MLX5DR_ACTION_TYP_TAG:
 	case MLX5DR_ACTION_TYP_DROP:
 	case MLX5DR_ACTION_TYP_CTR:
-	case MLX5DR_ACTION_TYP_FT:
+	case MLX5DR_ACTION_TYP_TBL:
 	case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
 	case MLX5DR_ACTION_TYP_ASO_METER:
 	case MLX5DR_ACTION_TYP_ASO_CT:
@@ -2178,7 +2178,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
 		switch (action_type[i]) {
 		case MLX5DR_ACTION_TYP_DROP:
 		case MLX5DR_ACTION_TYP_TIR:
-		case MLX5DR_ACTION_TYP_FT:
+		case MLX5DR_ACTION_TYP_TBL:
 		case MLX5DR_ACTION_TYP_DEST_ROOT:
 		case MLX5DR_ACTION_TYP_VPORT:
 		case MLX5DR_ACTION_TYP_MISS:
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -1
index 5064b23b7d..48810142a0 100644
@@ -12,7 +12,7 @@ const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3",
 	[MLX5DR_ACTION_TYP_DROP] = "DROP",
 	[MLX5DR_ACTION_TYP_TIR] = "TIR",
-	[MLX5DR_ACTION_TYP_FT] = "FT",
+	[MLX5DR_ACTION_TYP_TBL] = "TBL",
 	[MLX5DR_ACTION_TYP_CTR] = "CTR",
 	[MLX5DR_ACTION_TYP_TAG] = "TAG",
 	[MLX5DR_ACTION_TYP_MODIFY_HDR] = "MODIFY_HDR",
drivers/net/mlx5/mlx5_flow_hw.c +2 -2
index e1adc081c1..521df9ff40 100644
@@ -4520,7 +4520,7 @@ flow_hw_actions_validate(struct rte_eth_dev *dev,
 static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_MARK] = MLX5DR_ACTION_TYP_TAG,
 	[RTE_FLOW_ACTION_TYPE_DROP] = MLX5DR_ACTION_TYP_DROP,
-	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT,
+	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_TBL,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR,
 	[RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2,
@@ -4665,7 +4665,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
 			action_types[curr_off++] = MLX5DR_ACTION_TYP_ASO_METER;
 			if (curr_off >= MLX5_HW_MAX_ACTS)
 				goto err_actions_num;
-			action_types[curr_off++] = MLX5DR_ACTION_TYP_FT;
+			action_types[curr_off++] = MLX5DR_ACTION_TYP_TBL;
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
 			type = mlx5_hw_dr_action_types[at->actions[i].type];
Signature · 1 line
2.18.1
#18 lore raw

PATCH v3 5/5 net/mlx5/hws: support default miss action on FDB

In reply to Itamar Gozlan

From: Alex Vesker <[email protected]>

Add the support for default miss on HWS FDB, this implementation was missing until now. Default miss can be used for more efficient miss flow instead of going to an empty matcher or some defecated empty table.

---
 drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
 drivers/net/mlx5/hws/mlx5dr_table.c  |  6 +-----
 2 files changed, 21 insertions(+), 12 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +20 -7
index 74f4e60863..920099ba5b 100644
@@ -322,10 +322,12 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 	return 0;
 }
 
-static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
-					 struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
-					 enum mlx5dr_table_type table_type,
-					 bool is_mirror)
+static bool
+mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
+			     struct mlx5dr_cmd_stc_modify_attr *stc_attr,
+			     struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
+			     enum mlx5dr_table_type table_type,
+			     bool is_mirror)
 {
 	struct mlx5dr_devx_obj *devx_obj;
 	bool use_fixup = false;
@@ -348,6 +350,17 @@ static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_
 		use_fixup = true;
 		break;
 
+	case MLX5_IFC_STC_ACTION_TYPE_ALLOW:
+		if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
+			fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT;
+			fixup_stc_attr->action_offset = stc_attr->action_offset;
+			fixup_stc_attr->stc_offset = stc_attr->stc_offset;
+			fixup_stc_attr->vport.esw_owner_vhca_id = ctx->caps->vhca_id;
+			fixup_stc_attr->vport.vport_num = ctx->caps->eswitch_manager_vport_number;
+			use_fixup = true;
+		}
+		break;
+
 	case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT:
 		if (stc_attr->vport.vport_num != WIRE_PORT)
 			break;
@@ -397,7 +410,7 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 	devx_obj_0 = mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
 
 	/* According to table/action limitation change the stc_attr */
-	use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr, table_type, false);
+	use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr, &fixup_stc_attr, table_type, false);
 	ret = mlx5dr_cmd_stc_modify(devx_obj_0, use_fixup ? &fixup_stc_attr : stc_attr);
 	if (ret) {
 		DR_LOG(ERR, "Failed to modify STC action_type %d tbl_type %d",
@@ -411,7 +424,8 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 
 		devx_obj_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(stc_pool, stc);
 
-		use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr,
+		use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr,
+							 &fixup_stc_attr,
 							 table_type, true);
 		ret = mlx5dr_cmd_stc_modify(devx_obj_1, use_fixup ? &fixup_stc_attr : stc_attr);
 		if (ret) {
@@ -491,7 +505,6 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 	case MLX5DR_ACTION_TYP_MISS:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_ALLOW;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
-		/* TODO Need to support default miss for FDB */
 		break;
 	case MLX5DR_ACTION_TYP_CTR:
 		attr->id = obj->id;
drivers/net/mlx5/hws/mlx5dr_table.c +1 -5
index c18ee7c552..f91f04d924 100644
@@ -24,7 +24,6 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	struct mlx5dr_cmd_forward_tbl *default_miss;
 	struct mlx5dr_context *ctx = tbl->ctx;
 	uint8_t tbl_type = tbl->type;
-	uint32_t vport;
 
 	if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
 		return 0;
@@ -38,12 +37,9 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	ft_attr.level = tbl->ctx->caps->fdb_ft.max_level; /* The last level */
 	ft_attr.rtc_valid = false;
 
-	assert(ctx->caps->eswitch_manager);
-	vport = ctx->caps->eswitch_manager_vport_number;
-
 	fte_attr.action_flags = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 	fte_attr.destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-	fte_attr.destination_id = vport;
+	fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number;
 
 	default_miss = mlx5dr_cmd_forward_tbl_create(mlx5dr_context_get_local_ibv(ctx),
 						     &ft_attr, &fte_attr);
Signature · 1 line
2.18.1
#19 lore raw

RE: [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG

In reply to Itamar Gozlan

Hi,

Quoted 26 lines

-----Original Message-----
From: Itamar Gozlan <[email protected]>
Sent: Tuesday, July 4, 2023 7:05 PM
To: Alex Vesker <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; NBU- Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]
Subject: [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG

From: Alex Vesker <[email protected]>

In some places an extra new line was added, remove to have clean prints.

---
v1 -> v3
(1) amending a wrong subject prefix send (v1 instead of v3).
(2) typo fix (uneeded -> unneeded)
v2->v3
1. Right patches instead of wrong patches in the previous series v1->v2
1. Last patch in the series (net/mlx5/hws: support default miss action on FDB) needed some fixes to be properly rebased

Quoted 6 lines
 drivers/net/mlx5/hws/mlx5dr_action.c  | 30 +++++++++++++--------------
 drivers/net/mlx5/hws/mlx5dr_cmd.c     |  2 +-
 drivers/net/mlx5/hws/mlx5dr_definer.c |  4 ++--
drivers/net/mlx5/hws/mlx5dr_pat_arg.c |  4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#20 lore raw

PATCH v2 5/5 net/mlx5/hws: support default miss action on FDB

In reply to Itamar Gozlan

From: Alex Vesker <[email protected]>

Add the support for default miss on HWS FDB, this implementation was missing until now. Default miss can be used for more efficient miss flow instead of going to an empty matcher or some defecated empty table.

---
 drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
 drivers/net/mlx5/hws/mlx5dr_table.c  |  8 ++------
 2 files changed, 22 insertions(+), 13 deletions(-)
drivers/net/mlx5/hws/mlx5dr_action.c +20 -7
index a514b82fec..96c0c10cd9 100644
@@ -327,10 +327,12 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 	return 0;
 }
 
-static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
-					 struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
-					 enum mlx5dr_table_type table_type,
-					 bool is_mirror)
+static bool
+mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
+			     struct mlx5dr_cmd_stc_modify_attr *stc_attr,
+			     struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
+			     enum mlx5dr_table_type table_type,
+			     bool is_mirror)
 {
 	struct mlx5dr_devx_obj *devx_obj;
 	bool use_fixup = false;
@@ -353,6 +355,17 @@ static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_
 		use_fixup = true;
 		break;
 
+	case MLX5_IFC_STC_ACTION_TYPE_ALLOW:
+		if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
+			fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT;
+			fixup_stc_attr->action_offset = stc_attr->action_offset;
+			fixup_stc_attr->stc_offset = stc_attr->stc_offset;
+			fixup_stc_attr->vport.esw_owner_vhca_id = ctx->caps->vhca_id;
+			fixup_stc_attr->vport.vport_num = ctx->caps->eswitch_manager_vport_number;
+			use_fixup = true;
+		}
+		break;
+
 	case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT:
 		if (stc_attr->vport.vport_num != WIRE_PORT)
 			break;
@@ -402,7 +415,7 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 	devx_obj_0 = mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
 
 	/* According to table/action limitation change the stc_attr */
-	use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr, table_type, false);
+	use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr, &fixup_stc_attr, table_type, false);
 	ret = mlx5dr_cmd_stc_modify(devx_obj_0, use_fixup ? &fixup_stc_attr : stc_attr);
 	if (ret) {
 		DR_LOG(ERR, "Failed to modify STC action_type %d tbl_type %d",
@@ -416,7 +429,8 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 
 		devx_obj_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(stc_pool, stc);
 
-		use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr,
+		use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr,
+							 &fixup_stc_attr,
 							 table_type, true);
 		ret = mlx5dr_cmd_stc_modify(devx_obj_1, use_fixup ? &fixup_stc_attr : stc_attr);
 		if (ret) {
@@ -496,7 +510,6 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 	case MLX5DR_ACTION_TYP_MISS:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_ALLOW;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
-		/* TODO Need to support default miss for FDB */
 		break;
 	case MLX5DR_ACTION_TYP_CTR:
 		attr->id = obj->id;
drivers/net/mlx5/hws/mlx5dr_table.c +2 -6
index 46c2a47015..2c8b7a2b9e 100644
@@ -25,8 +25,6 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	struct mlx5dr_cmd_set_fte_dest dest = {0};
 	struct mlx5dr_context *ctx = tbl->ctx;
 	uint8_t tbl_type = tbl->type;
-	uint32_t vport;
-
 	if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
 		return 0;
 
@@ -39,11 +37,9 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	ft_attr.level = tbl->ctx->caps->fdb_ft.max_level; /* The last level */
 	ft_attr.rtc_valid = false;
 
-	assert(ctx->caps->eswitch_manager);
-	vport = ctx->caps->eswitch_manager_vport_number;
-
 	dest.destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-	dest.destination_id = vport;
+	dest.destination_id = ctx->caps->eswitch_manager_vport_number;
+
 	fte_attr.action_flags = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 	fte_attr.dests_num = 1;
 	fte_attr.dests = &dest;
Signature · 1 line
2.18.1