* [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG
@ 2023-06-29 7:21 Itamar Gozlan
2023-06-29 7:21 ` [PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-06-29 7:21 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
In some places an extra new line was added, remove to
have clean prints.
Signed-off-by: Alex Vesker <valex@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 01d30b8442..e2db85940c 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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;
}
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index f1ae256a7e..f9f220cc6a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -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;
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 7b01f4c9ec..33d0f2d18e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -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;
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index 830bc08678..bedaedb677 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -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;
}
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error
2023-06-29 7:21 [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
@ 2023-06-29 7:21 ` Itamar Gozlan
2023-06-29 7:21 ` [PATCH 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
` (2 subsequent siblings)
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-06-29 7:21 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 071e1ad769..931c68b160 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -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 */
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/5] net/mlx5/hws: remove duplicated reformat type
2023-06-29 7:21 [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-06-29 7:21 ` [PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
@ 2023-06-29 7:21 ` Itamar Gozlan
2023-06-29 7:21 ` [PATCH 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-06-29 7:21 ` [PATCH 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-06-29 7:21 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev, Shun Hao
From: Shun Hao <shunh@nvidia.com>
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.
Signed-off-by: Shun Hao <shunh@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7942fb0a8f..7d5af4c9bb 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -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,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index e2db85940c..851cee8802 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -18,8 +18,8 @@
static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_MAX] = {
[MLX5DR_TABLE_TYPE_NIC_RX] = {
BIT(MLX5DR_ACTION_TYP_TAG),
- BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) |
- BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2),
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) |
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_CTR),
@@ -28,8 +28,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_TIR) |
@@ -46,8 +46,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -55,8 +55,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_LAST),
},
[MLX5DR_TABLE_TYPE_FDB] = {
- BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) |
- BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2),
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) |
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_CTR),
@@ -65,8 +65,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_VPORT) |
@@ -292,10 +292,10 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
case MLX5DR_ACTION_TYP_DROP:
attr[i].type = MLX5DV_FLOW_ACTION_DROP;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr[i].type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
attr[i].action = action->flow_action;
@@ -503,7 +503,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
attr->dest_tir_num = obj->id;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
if (action->modify_header.num_of_actions == 1) {
@@ -529,14 +529,14 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
attr->dest_table_id = action->root_tbl.sa->id;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_REMOVE;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW5;
attr->remove_header.decap = 1;
attr->remove_header.start_anchor = MLX5_HEADER_ANCHOR_PACKET_START;
attr->remove_header.end_anchor = MLX5_HEADER_ANCHOR_INNER_MAC;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
attr->insert_header.encap = 1;
@@ -544,7 +544,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->insert_header.arg_id = action->reformat.arg_obj->id;
attr->insert_header.header_size = action->reformat.header_size;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
attr->insert_header.encap = 1;
@@ -1128,49 +1128,24 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags)
return NULL;
}
-static int
-mlx5dr_action_conv_reformat_type_to_action(uint32_t reformat_type,
- enum mlx5dr_action_type *action_type)
-{
- switch (reformat_type) {
- case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2:
- *action_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2:
- *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2:
- *action_type = MLX5DR_ACTION_TYP_TNL_L3_TO_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3:
- *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L3;
- break;
- default:
- DR_LOG(ERR, "Invalid reformat type requested");
- rte_errno = ENOTSUP;
- return rte_errno;
- }
- return 0;
-}
-
static void
mlx5dr_action_conv_reformat_to_verbs(uint32_t action_type,
uint32_t *verb_reformat_type)
{
switch (action_type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL;
break;
@@ -1470,16 +1445,16 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_context *ctx,
int ret;
switch (action->type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
ret = mlx5dr_action_create_stcs(action, NULL);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
ret = mlx5dr_action_handle_l2_to_tunnel_l2(ctx, data_sz, data, bulk_size, action);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
ret = mlx5dr_action_handle_l2_to_tunnel_l3(ctx, data_sz, data, bulk_size, action);
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
ret = mlx5dr_action_handle_tunnel_l3_to_l2(ctx, data_sz, data, bulk_size, action);
break;
@@ -1494,21 +1469,16 @@ mlx5dr_action_create_reformat_hws(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,
uint32_t flags)
{
- enum mlx5dr_action_type action_type;
struct mlx5dr_action *action;
int ret;
- ret = mlx5dr_action_conv_reformat_type_to_action(reformat_type, &action_type);
- if (ret)
- return NULL;
-
- action = mlx5dr_action_create_generic(ctx, flags, action_type);
+ action = mlx5dr_action_create_generic(ctx, flags, reformat_type);
if (!action)
return NULL;
@@ -1712,7 +1682,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
case MLX5DR_ACTION_TYP_DROP:
case MLX5DR_ACTION_TYP_CTR:
case MLX5DR_ACTION_TYP_FT:
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
case MLX5DR_ACTION_TYP_ASO_METER:
case MLX5DR_ACTION_TYP_ASO_CT:
case MLX5DR_ACTION_TYP_PUSH_VLAN:
@@ -1726,18 +1696,18 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
mlx5dr_action_destroy_stcs(action);
mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_POP);
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
mlx5dr_action_destroy_stcs(action);
if (action->modify_header.num_of_actions > 1)
mlx5dr_pat_arg_destroy_modify_header(action->ctx, action);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
mlx5dr_action_destroy_stcs(action);
mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_DECAP);
mlx5dr_cmd_destroy_obj(action->reformat.arg_obj);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
mlx5dr_action_destroy_stcs(action);
mlx5dr_cmd_destroy_obj(action->reformat.arg_obj);
break;
@@ -1747,10 +1717,10 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
static void mlx5dr_action_destroy_root(struct mlx5dr_action *action)
{
switch (action->type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
ibv_destroy_flow_action(action->flow_action);
break;
@@ -2256,7 +2226,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
/* Single remove header to header */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_MODIFY);
setter->flags |= ASF_SINGLE1 | ASF_REMOVE | ASF_REPARSE;
@@ -2264,7 +2234,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_single = i;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
/* Double insert header with pointer */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE);
setter->flags |= ASF_DOUBLE | ASF_REPARSE;
@@ -2272,7 +2242,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
/* Single remove + Double insert header with pointer */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_DOUBLE);
setter->flags |= ASF_SINGLE1 | ASF_DOUBLE | ASF_REPARSE | ASF_REMOVE;
@@ -2282,7 +2252,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_single = i;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
/* Double modify header list with remove and push inline */
setter = mlx5dr_action_setter_find_first(last_setter,
ASF_DOUBLE | ASF_REMOVE);
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index d249f8d869..5064b23b7d 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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",
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index bedaedb677..309a61d477 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -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++) {
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index b5137a822a..e274fbf34d 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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) {
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 4/5] net/mlx5/hws: renaming FT to TBL
2023-06-29 7:21 [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-06-29 7:21 ` [PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-06-29 7:21 ` [PATCH 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
@ 2023-06-29 7:21 ` Itamar Gozlan
2023-06-29 7:21 ` [PATCH 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-06-29 7:21 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
An action naming change is made to describe the action better
and avoid implicit meaning.
Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7d5af4c9bb..ec2230d136 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -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,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 851cee8802..74f4e60863 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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:
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 5064b23b7d..48810142a0 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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",
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index e274fbf34d..bbe0c5ec8a 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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];
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 5/5] net/mlx5/hws: support default miss action on FDB
2023-06-29 7:21 [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
` (2 preceding siblings ...)
2023-06-29 7:21 ` [PATCH 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
@ 2023-06-29 7:21 ` Itamar Gozlan
2023-07-02 4:57 ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
3 siblings, 1 reply; 21+ messages in thread
From: Itamar Gozlan @ 2023-06-29 7:21 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_table.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index c18ee7c552..fd5b54ff0b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -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);
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2 1/5] net/mlx5: support indirect list METER_MARK action
2023-06-29 7:21 ` [PATCH 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
@ 2023-07-02 4:57 ` Itamar Gozlan
2023-07-02 4:57 ` [v2 2/5] app/testpmd: support indirect actions list syntax Itamar Gozlan
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-02 4:57 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm; +Cc: dev, orika, Gregory Etelson
From: Gregory Etelson <getelson@nvidia.com>
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 29e9819dd6..fb7b82fa26 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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).
*
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index e4c03a6be2..46bfd4d8a7 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -113,25 +113,41 @@ enum mlx5_indirect_type{
#define MLX5_ACTION_CTX_CT_GEN_IDX MLX5_INDIRECT_ACT_CT_GEN_IDX
enum mlx5_indirect_list_type {
- MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 1,
+ MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
+ MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
+ MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 2,
};
-/*
+/**
* Base type for indirect list type.
- * Actual indirect list type MUST override that type and put type spec data
- * after the `chain`.
*/
struct mlx5_indirect_list {
- /* type field MUST be the first */
+ /* Indirect list type. */
enum mlx5_indirect_list_type type;
+ /* Optional storage list entry */
LIST_ENTRY(mlx5_indirect_list) entry;
- /* put type specific data after chain */
};
+static __rte_always_inline void
+mlx5_indirect_list_add_entry(void *head, struct mlx5_indirect_list *elem)
+{
+ LIST_HEAD(, mlx5_indirect_list) *h = head;
+
+ LIST_INSERT_HEAD(h, elem, entry);
+}
+
+static __rte_always_inline void
+mlx5_indirect_list_remove_entry(struct mlx5_indirect_list *elem)
+{
+ if (elem->entry.le_prev)
+ LIST_REMOVE(elem, entry);
+
+}
+
static __rte_always_inline enum mlx5_indirect_list_type
-mlx5_get_indirect_list_type(const struct mlx5_indirect_list *obj)
+mlx5_get_indirect_list_type(const struct rte_flow_action_list_handle *obj)
{
- return obj->type;
+ return ((const struct mlx5_indirect_list *)obj)->type;
}
/* Matches on selected register. */
@@ -1292,9 +1308,12 @@ struct rte_flow_hw {
#pragma GCC diagnostic error "-Wpedantic"
#endif
-struct mlx5dr_action;
-typedef struct mlx5dr_action *
-(*indirect_list_callback_t)(const struct rte_flow_action *);
+struct mlx5_action_construct_data;
+typedef int
+(*indirect_list_callback_t)(struct rte_eth_dev *,
+ const struct mlx5_action_construct_data *,
+ const struct rte_flow_action *,
+ struct mlx5dr_rule_action *);
/* rte flow action translate to DR action struct. */
struct mlx5_action_construct_data {
@@ -1342,6 +1361,7 @@ struct mlx5_action_construct_data {
} shared_counter;
struct {
uint32_t id;
+ uint32_t conf_masked:1;
} shared_meter;
struct {
indirect_list_callback_t cb;
@@ -2162,7 +2182,21 @@ typedef int
const struct rte_flow_op_attr *op_attr,
struct rte_flow_action_list_handle *action_handle,
void *user_data, struct rte_flow_error *error);
-
+typedef int
+(*mlx5_flow_action_list_handle_query_update_t)
+ (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);
+typedef int
+(*mlx5_flow_async_action_list_handle_query_update_t)
+ (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);
struct mlx5_flow_driver_ops {
mlx5_flow_validate_t validate;
@@ -2230,6 +2264,10 @@ struct mlx5_flow_driver_ops {
async_action_list_handle_create;
mlx5_flow_async_action_list_handle_destroy_t
async_action_list_handle_destroy;
+ mlx5_flow_action_list_handle_query_update_t
+ action_list_handle_query_update;
+ mlx5_flow_async_action_list_handle_query_update_t
+ async_action_list_handle_query_update;
};
/* mlx5_flow.c */
@@ -2999,6 +3037,9 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev);
#ifdef HAVE_MLX5_HWS_SUPPORT
struct mlx5_mirror;
void
-mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror, bool release);
+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);
#endif
#endif /* RTE_PMD_MLX5_FLOW_H_ */
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 87db302bae..7b4661ad4f 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -67,16 +67,19 @@
(!!((priv)->sh->esw_mode && (priv)->master))
+struct mlx5_indlst_legacy {
+ struct mlx5_indirect_list indirect;
+ struct rte_flow_action_handle *handle;
+ enum rte_flow_action_type legacy_type;
+};
+
struct mlx5_mirror_clone {
enum rte_flow_action_type type;
void *action_ctx;
};
struct mlx5_mirror {
- /* type field MUST be the first */
- enum mlx5_indirect_list_type type;
- LIST_ENTRY(mlx5_indirect_list) entry;
-
+ struct mlx5_indirect_list indirect;
uint32_t clones_num;
struct mlx5dr_action *mirror_action;
struct mlx5_mirror_clone clone[MLX5_MIRROR_MAX_CLONES_NUM];
@@ -1424,46 +1427,211 @@ flow_hw_meter_mark_compile(struct rte_eth_dev *dev,
return 0;
}
-static struct mlx5dr_action *
-flow_hw_mirror_action(const struct rte_flow_action *action)
+static int
+flow_hw_translate_indirect_mirror(__rte_unused struct rte_eth_dev *dev,
+ __rte_unused const struct mlx5_action_construct_data *act_data,
+ const struct rte_flow_action *action,
+ struct mlx5dr_rule_action *dr_rule)
+{
+ const struct rte_flow_action_indirect_list *list_conf = action->conf;
+ const struct mlx5_mirror *mirror = (typeof(mirror))list_conf->handle;
+
+ dr_rule->action = mirror->mirror_action;
+ return 0;
+}
+
+/**
+ * HWS mirror implemented as FW island.
+ * The action does not support indirect list flow configuration.
+ * If template handle was masked, use handle mirror action in flow rules.
+ * Otherwise let flow rule specify mirror handle.
+ */
+static int
+hws_table_tmpl_translate_indirect_mirror(struct rte_eth_dev *dev,
+ const struct rte_flow_action *action,
+ const struct rte_flow_action *mask,
+ struct mlx5_hw_actions *acts,
+ uint16_t action_src, uint16_t action_dst)
+{
+ int ret = 0;
+ const struct rte_flow_action_indirect_list *mask_conf = mask->conf;
+
+ if (mask_conf && mask_conf->handle) {
+ /**
+ * If mirror handle was masked, assign fixed DR5 mirror action.
+ */
+ flow_hw_translate_indirect_mirror(dev, NULL, action,
+ &acts->rule_acts[action_dst]);
+ } else {
+ struct mlx5_priv *priv = dev->data->dev_private;
+ ret = flow_hw_act_data_indirect_list_append
+ (priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
+ action_src, action_dst,
+ flow_hw_translate_indirect_mirror);
+ }
+ return ret;
+}
+
+static int
+flow_dr_set_meter(struct mlx5_priv *priv,
+ struct mlx5dr_rule_action *dr_rule,
+ const struct rte_flow_action_indirect_list *action_conf)
{
- struct mlx5_mirror *mirror = (void *)(uintptr_t)action->conf;
+ const struct mlx5_indlst_legacy *legacy_obj =
+ (typeof(legacy_obj))action_conf->handle;
+ struct mlx5_aso_mtr_pool *mtr_pool = priv->hws_mpool;
+ uint32_t act_idx = (uint32_t)(uintptr_t)legacy_obj->handle;
+ uint32_t mtr_id = act_idx & (RTE_BIT32(MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+ struct mlx5_aso_mtr *aso_mtr = mlx5_ipool_get(mtr_pool->idx_pool, mtr_id);
+
+ if (!aso_mtr)
+ return -EINVAL;
+ dr_rule->action = mtr_pool->action;
+ dr_rule->aso_meter.offset = aso_mtr->offset;
+ return 0;
+}
- return mirror->mirror_action;
+__rte_always_inline static void
+flow_dr_mtr_flow_color(struct mlx5dr_rule_action *dr_rule, enum rte_color init_color)
+{
+ dr_rule->aso_meter.init_color =
+ (enum mlx5dr_action_aso_meter_color)rte_col_2_mlx5_col(init_color);
}
+static int
+flow_hw_translate_indirect_meter(struct rte_eth_dev *dev,
+ const struct mlx5_action_construct_data *act_data,
+ const struct rte_flow_action *action,
+ struct mlx5dr_rule_action *dr_rule)
+{
+ int ret;
+ struct mlx5_priv *priv = dev->data->dev_private;
+ const struct rte_flow_action_indirect_list *action_conf = action->conf;
+ const struct rte_flow_indirect_update_flow_meter_mark **flow_conf =
+ (typeof(flow_conf))action_conf->conf;
+
+ /*
+ * Masked indirect handle set dr5 action during template table
+ * translation.
+ */
+ if (!dr_rule->action) {
+ ret = flow_dr_set_meter(priv, dr_rule, action_conf);
+ if (ret)
+ return ret;
+ }
+ if (!act_data->shared_meter.conf_masked) {
+ if (flow_conf && flow_conf[0] && flow_conf[0]->init_color < RTE_COLORS)
+ flow_dr_mtr_flow_color(dr_rule, flow_conf[0]->init_color);
+ }
+ return 0;
+}
+
+static int
+hws_table_tmpl_translate_indirect_meter(struct rte_eth_dev *dev,
+ const struct rte_flow_action *action,
+ const struct rte_flow_action *mask,
+ struct mlx5_hw_actions *acts,
+ uint16_t action_src, uint16_t action_dst)
+{
+ int ret;
+ struct mlx5_priv *priv = dev->data->dev_private;
+ const struct rte_flow_action_indirect_list *action_conf = action->conf;
+ const struct rte_flow_action_indirect_list *mask_conf = mask->conf;
+ bool is_handle_masked = mask_conf && mask_conf->handle;
+ bool is_conf_masked = mask_conf && mask_conf->conf && mask_conf->conf[0];
+ struct mlx5dr_rule_action *dr_rule = &acts->rule_acts[action_dst];
+
+ if (is_handle_masked) {
+ ret = flow_dr_set_meter(priv, dr_rule, action->conf);
+ if (ret)
+ return ret;
+ }
+ if (is_conf_masked) {
+ const struct
+ rte_flow_indirect_update_flow_meter_mark **flow_conf =
+ (typeof(flow_conf))action_conf->conf;
+ flow_dr_mtr_flow_color(dr_rule,
+ flow_conf[0]->init_color);
+ }
+ if (!is_handle_masked || !is_conf_masked) {
+ struct mlx5_action_construct_data *act_data;
+
+ ret = flow_hw_act_data_indirect_list_append
+ (priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
+ action_src, action_dst, flow_hw_translate_indirect_meter);
+ if (ret)
+ return ret;
+ act_data = LIST_FIRST(&acts->act_list);
+ act_data->shared_meter.conf_masked = is_conf_masked;
+ }
+ return 0;
+}
+
+static int
+hws_table_tmpl_translate_indirect_legacy(struct rte_eth_dev *dev,
+ const struct rte_flow_action *action,
+ const struct rte_flow_action *mask,
+ struct mlx5_hw_actions *acts,
+ uint16_t action_src, uint16_t action_dst)
+{
+ int ret;
+ const struct rte_flow_action_indirect_list *indlst_conf = action->conf;
+ struct mlx5_indlst_legacy *indlst_obj = (typeof(indlst_obj))indlst_conf->handle;
+ uint32_t act_idx = (uint32_t)(uintptr_t)indlst_obj->handle;
+ uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+
+ switch (type) {
+ case MLX5_INDIRECT_ACTION_TYPE_METER_MARK:
+ ret = hws_table_tmpl_translate_indirect_meter(dev, action, mask,
+ acts, action_src,
+ action_dst);
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ return ret;
+}
+
+/*
+ * template .. indirect_list handle Ht conf Ct ..
+ * mask .. indirect_list handle Hm conf Cm ..
+ *
+ * PMD requires Ht != 0 to resolve handle type.
+ * If Ht was masked (Hm != 0) DR5 action will be set according to Ht and will
+ * not change. Otherwise, DR5 action will be resolved during flow rule build.
+ * If Ct was masked (Cm != 0), table template processing updates base
+ * indirect action configuration with Ct parameters.
+ */
static int
table_template_translate_indirect_list(struct rte_eth_dev *dev,
const struct rte_flow_action *action,
const struct rte_flow_action *mask,
struct mlx5_hw_actions *acts,
- uint16_t action_src,
- uint16_t action_dst)
+ uint16_t action_src, uint16_t action_dst)
{
- int ret;
- bool is_masked = action->conf && mask->conf;
- struct mlx5_priv *priv = dev->data->dev_private;
+ int ret = 0;
enum mlx5_indirect_list_type type;
+ const struct rte_flow_action_indirect_list *list_conf = action->conf;
- if (!action->conf)
+ if (!list_conf || !list_conf->handle)
return -EINVAL;
- type = mlx5_get_indirect_list_type(action->conf);
+ type = mlx5_get_indirect_list_type(list_conf->handle);
switch (type) {
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
+ ret = hws_table_tmpl_translate_indirect_legacy(dev, action, mask,
+ acts, action_src,
+ action_dst);
+ break;
case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
- if (is_masked) {
- acts->rule_acts[action_dst].action = flow_hw_mirror_action(action);
- } else {
- ret = flow_hw_act_data_indirect_list_append
- (priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
- action_src, action_dst, flow_hw_mirror_action);
- if (ret)
- return ret;
- }
+ ret = hws_table_tmpl_translate_indirect_mirror(dev, action, mask,
+ acts, action_src,
+ action_dst);
break;
default:
return -EINVAL;
}
- return 0;
+ return ret;
}
/**
@@ -2383,8 +2551,7 @@ flow_hw_actions_construct(struct rte_eth_dev *dev,
(int)action->type == act_data->type);
switch ((int)act_data->type) {
case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST:
- rule_acts[act_data->action_dst].action =
- act_data->indirect_list.cb(action);
+ act_data->indirect_list.cb(dev, act_data, actions, rule_acts);
break;
case MLX5_RTE_FLOW_ACTION_TYPE_IPSEC:
/* Fall-through. */
@@ -4741,20 +4908,11 @@ action_template_set_type(struct rte_flow_actions_template *at,
}
static int
-flow_hw_dr_actions_template_handle_shared(const struct rte_flow_action *mask,
- unsigned int action_src,
+flow_hw_dr_actions_template_handle_shared(int type, uint32_t action_src,
enum mlx5dr_action_type *action_types,
uint16_t *curr_off, uint16_t *cnt_off,
struct rte_flow_actions_template *at)
{
- uint32_t type;
-
- if (!mask) {
- DRV_LOG(WARNING, "Unable to determine indirect action type "
- "without a mask specified");
- return -EINVAL;
- }
- type = mask->type;
switch (type) {
case RTE_FLOW_ACTION_TYPE_RSS:
action_template_set_type(at, action_types, action_src, curr_off,
@@ -4799,12 +4957,24 @@ static int
flow_hw_template_actions_list(struct rte_flow_actions_template *at,
unsigned int action_src,
enum mlx5dr_action_type *action_types,
- uint16_t *curr_off)
+ uint16_t *curr_off, uint16_t *cnt_off)
{
- enum mlx5_indirect_list_type list_type;
+ int ret;
+ const struct rte_flow_action_indirect_list *indlst_conf = at->actions[action_src].conf;
+ enum mlx5_indirect_list_type list_type = mlx5_get_indirect_list_type(indlst_conf->handle);
+ const union {
+ struct mlx5_indlst_legacy *legacy;
+ struct rte_flow_action_list_handle *handle;
+ } indlst_obj = { .handle = indlst_conf->handle };
- list_type = mlx5_get_indirect_list_type(at->actions[action_src].conf);
switch (list_type) {
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
+ ret = flow_hw_dr_actions_template_handle_shared
+ (indlst_obj.legacy->legacy_type, action_src,
+ action_types, curr_off, cnt_off, at);
+ if (ret)
+ return ret;
+ break;
case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
action_template_set_type(at, action_types, action_src, curr_off,
MLX5DR_ACTION_TYP_DEST_ARRAY);
@@ -4850,7 +5020,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
break;
case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST:
ret = flow_hw_template_actions_list(at, i, action_types,
- &curr_off);
+ &curr_off, &cnt_off);
if (ret)
return NULL;
break;
@@ -4858,11 +5028,8 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at)
/* Fall-through. */
case RTE_FLOW_ACTION_TYPE_INDIRECT:
ret = flow_hw_dr_actions_template_handle_shared
- (&at->masks[i],
- i,
- action_types,
- &curr_off,
- &cnt_off, at);
+ (at->masks[i].type, i, action_types,
+ &curr_off, &cnt_off, at);
if (ret)
return NULL;
break;
@@ -5339,7 +5506,6 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,
* Need to restore the indirect action index from action conf here.
*/
case RTE_FLOW_ACTION_TYPE_INDIRECT:
- case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST:
at->actions[i].conf = ra[i].conf;
at->masks[i].conf = rm[i].conf;
break;
@@ -9476,18 +9642,16 @@ mlx5_mirror_destroy_clone(struct rte_eth_dev *dev,
}
void
-mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror, bool release)
+mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror)
{
uint32_t i;
- if (mirror->entry.le_prev)
- LIST_REMOVE(mirror, entry);
+ mlx5_indirect_list_remove_entry(&mirror->indirect);
for(i = 0; i < mirror->clones_num; i++)
mlx5_mirror_destroy_clone(dev, &mirror->clone[i]);
if (mirror->mirror_action)
mlx5dr_action_destroy(mirror->mirror_action);
- if (release)
- mlx5_free(mirror);
+ mlx5_free(mirror);
}
static inline enum mlx5dr_table_type
@@ -9798,7 +9962,8 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,
actions, "Failed to allocate mirror context");
return NULL;
}
- mirror->type = MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR;
+
+ mirror->indirect.type = MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR;
mirror->clones_num = clones_num;
for (i = 0; i < clones_num; i++) {
const struct rte_flow_action *clone_actions;
@@ -9830,15 +9995,72 @@ mlx5_hw_mirror_handle_create(struct rte_eth_dev *dev,
goto error;
}
- LIST_INSERT_HEAD(&priv->indirect_list_head,
- (struct mlx5_indirect_list *)mirror, entry);
+ mlx5_indirect_list_add_entry(&priv->indirect_list_head, &mirror->indirect);
return (struct rte_flow_action_list_handle *)mirror;
error:
- mlx5_hw_mirror_destroy(dev, mirror, true);
+ mlx5_hw_mirror_destroy(dev, mirror);
return NULL;
}
+void
+mlx5_destroy_legacy_indirect(__rte_unused struct rte_eth_dev *dev,
+ struct mlx5_indirect_list *ptr)
+{
+ struct mlx5_indlst_legacy *obj = (typeof(obj))ptr;
+
+ switch (obj->legacy_type) {
+ case RTE_FLOW_ACTION_TYPE_METER_MARK:
+ break; /* ASO meters were released in mlx5_flow_meter_flush() */
+ default:
+ break;
+ }
+ mlx5_free(obj);
+}
+
+static struct rte_flow_action_list_handle *
+mlx5_create_legacy_indlst(struct rte_eth_dev *dev, uint32_t queue,
+ const struct rte_flow_op_attr *attr,
+ const struct rte_flow_indir_action_conf *conf,
+ const struct rte_flow_action *actions,
+ void *user_data, struct rte_flow_error *error)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_indlst_legacy *indlst_obj = mlx5_malloc(MLX5_MEM_ZERO,
+ sizeof(*indlst_obj),
+ 0, SOCKET_ID_ANY);
+
+ if (!indlst_obj)
+ return NULL;
+ indlst_obj->handle = flow_hw_action_handle_create(dev, queue, attr, conf,
+ actions, user_data,
+ error);
+ if (!indlst_obj->handle) {
+ mlx5_free(indlst_obj);
+ return NULL;
+ }
+ indlst_obj->legacy_type = actions[0].type;
+ indlst_obj->indirect.type = MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY;
+ mlx5_indirect_list_add_entry(&priv->indirect_list_head, &indlst_obj->indirect);
+ return (struct rte_flow_action_list_handle *)indlst_obj;
+}
+
+static __rte_always_inline enum mlx5_indirect_list_type
+flow_hw_inlist_type_get(const struct rte_flow_action *actions)
+{
+ switch (actions[0].type) {
+ case RTE_FLOW_ACTION_TYPE_SAMPLE:
+ return MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR;
+ case RTE_FLOW_ACTION_TYPE_METER_MARK:
+ return actions[1].type == RTE_FLOW_ACTION_TYPE_END ?
+ MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY :
+ MLX5_INDIRECT_ACTION_LIST_TYPE_ERR;
+ default:
+ break;
+ }
+ return MLX5_INDIRECT_ACTION_LIST_TYPE_ERR;
+}
+
static struct rte_flow_action_list_handle *
flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
const struct rte_flow_op_attr *attr,
@@ -9849,6 +10071,7 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
{
struct mlx5_hw_q_job *job = NULL;
bool push = flow_hw_action_push(attr);
+ enum mlx5_indirect_list_type list_type;
struct rte_flow_action_list_handle *handle;
struct mlx5_priv *priv = dev->data->dev_private;
const struct mlx5_flow_template_table_cfg table_cfg = {
@@ -9867,6 +10090,16 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
NULL, "No action list");
return NULL;
}
+ list_type = flow_hw_inlist_type_get(actions);
+ if (list_type == MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY) {
+ /*
+ * Legacy indirect actions already have
+ * async resources management. No need to do it twice.
+ */
+ handle = mlx5_create_legacy_indlst(dev, queue, attr, conf,
+ actions, user_data, error);
+ goto end;
+ }
if (attr) {
job = flow_hw_action_job_init(priv, queue, NULL, user_data,
NULL, MLX5_HW_Q_JOB_TYPE_CREATE,
@@ -9874,8 +10107,8 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
if (!job)
return NULL;
}
- switch (actions[0].type) {
- case RTE_FLOW_ACTION_TYPE_SAMPLE:
+ switch (list_type) {
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
handle = mlx5_hw_mirror_handle_create(dev, &table_cfg,
actions, error);
break;
@@ -9889,6 +10122,7 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
flow_hw_action_finalize(dev, queue, job, push, false,
handle != NULL);
}
+end:
return handle;
}
@@ -9917,6 +10151,15 @@ flow_hw_async_action_list_handle_destroy
enum mlx5_indirect_list_type type =
mlx5_get_indirect_list_type((void *)handle);
+ if (type == MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY) {
+ struct mlx5_indlst_legacy *legacy = (typeof(legacy))handle;
+
+ ret = flow_hw_action_handle_destroy(dev, queue, attr,
+ legacy->handle,
+ user_data, error);
+ mlx5_indirect_list_remove_entry(&legacy->indirect);
+ goto end;
+ }
if (attr) {
job = flow_hw_action_job_init(priv, queue, NULL, user_data,
NULL, MLX5_HW_Q_JOB_TYPE_DESTROY,
@@ -9926,20 +10169,17 @@ flow_hw_async_action_list_handle_destroy
}
switch(type) {
case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
- mlx5_hw_mirror_destroy(dev, (struct mlx5_mirror *)handle, false);
+ mlx5_hw_mirror_destroy(dev, (struct mlx5_mirror *)handle);
break;
default:
- handle = NULL;
ret = rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
NULL, "Invalid indirect list handle");
}
if (job) {
- job->action = handle;
- flow_hw_action_finalize(dev, queue, job, push, false,
- handle != NULL);
+ flow_hw_action_finalize(dev, queue, job, push, false, true);
}
- mlx5_free(handle);
+end:
return ret;
}
@@ -9953,6 +10193,53 @@ flow_hw_action_list_handle_destroy(struct rte_eth_dev *dev,
error);
}
+static int
+flow_hw_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)
+{
+ enum mlx5_indirect_list_type type =
+ mlx5_get_indirect_list_type((const void *)handle);
+
+ if (type == MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY) {
+ struct mlx5_indlst_legacy *legacy = (void *)(uintptr_t)handle;
+
+ if (update && query)
+ return flow_hw_async_action_handle_query_update
+ (dev, queue_id, attr, legacy->handle,
+ update, query, mode, user_data, error);
+ else if (update && update[0])
+ return flow_hw_action_handle_update(dev, queue_id, attr,
+ legacy->handle, update[0],
+ user_data, error);
+ else if (query && query[0])
+ return flow_hw_action_handle_query(dev, queue_id, attr,
+ legacy->handle, query[0],
+ user_data, error);
+ else
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL, "invalid legacy handle query_update parameters");
+ }
+ return -ENOTSUP;
+}
+
+static int
+flow_hw_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)
+{
+ return flow_hw_async_action_list_handle_query_update
+ (dev, MLX5_HW_INV_QUEUE, NULL, handle,
+ update, query, mode, NULL, error);
+}
+
const struct mlx5_flow_driver_ops mlx5_flow_hw_drv_ops = {
.info_get = flow_hw_info_get,
.configure = flow_hw_configure,
@@ -9983,10 +10270,14 @@ const struct mlx5_flow_driver_ops mlx5_flow_hw_drv_ops = {
.action_query_update = flow_hw_action_query_update,
.action_list_handle_create = flow_hw_action_list_handle_create,
.action_list_handle_destroy = flow_hw_action_list_handle_destroy,
+ .action_list_handle_query_update =
+ flow_hw_action_list_handle_query_update,
.async_action_list_handle_create =
flow_hw_async_action_list_handle_create,
.async_action_list_handle_destroy =
flow_hw_async_action_list_handle_destroy,
+ .async_action_list_handle_query_update =
+ flow_hw_async_action_list_handle_query_update,
.query = flow_hw_query,
.get_aged_flows = flow_hw_get_aged_flows,
.get_q_aged_flows = flow_hw_get_q_aged_flows,
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2 2/5] app/testpmd: support indirect actions list syntax
2023-07-02 4:57 ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
@ 2023-07-02 4:57 ` Itamar Gozlan
2023-07-02 4:57 ` [v2 3/5] net/mlx5: add indirect encap decap support Itamar Gozlan
` (2 subsequent siblings)
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-02 4:57 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam,
Aman Singh, Yuying Zhang
Cc: dev, Gregory Etelson
From: Gregory Etelson <getelson@nvidia.com>
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].
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
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(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 7eb8e045b4..1644328bf4 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -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). */
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 36cfa7fe95..5ae4cb9a25 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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) {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index eed5c70608..2e888cb2f9 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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,
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2 3/5] net/mlx5: add indirect encap decap support
2023-07-02 4:57 ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
2023-07-02 4:57 ` [v2 2/5] app/testpmd: support indirect actions list syntax Itamar Gozlan
@ 2023-07-02 4:57 ` Itamar Gozlan
2023-07-02 4:57 ` [v2 4/5] net/mlx5: support symmetric RSS hash function Itamar Gozlan
2023-07-02 4:57 ` [v2 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-02 4:57 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm; +Cc: dev, orika, Rongwei Liu
From: Rongwei Liu <rongweil@nvidia.com>
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
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
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(+)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index fb7b82fa26..45f2210ae7 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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");
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 46bfd4d8a7..e273bd958d 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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_ */
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 7b4661ad4f..5e5ebbe620 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1472,6 +1472,49 @@ hws_table_tmpl_translate_indirect_mirror(struct rte_eth_dev *dev,
return ret;
}
+static int
+flow_hw_reformat_action(__rte_unused struct rte_eth_dev *dev,
+ __rte_unused const struct mlx5_action_construct_data *data,
+ const struct rte_flow_action *action,
+ struct mlx5dr_rule_action *dr_rule)
+{
+ const struct rte_flow_action_indirect_list *indlst_conf = action->conf;
+
+ dr_rule->action = ((struct mlx5_hw_encap_decap_action *)
+ (indlst_conf->handle))->action;
+ if (!dr_rule->action)
+ return -EINVAL;
+ return 0;
+}
+
+/**
+ * Template conf must not be masked. If handle is masked, use the one in template,
+ * otherwise update per flow rule.
+ */
+static int
+hws_table_tmpl_translate_indirect_reformat(struct rte_eth_dev *dev,
+ const struct rte_flow_action *action,
+ const struct rte_flow_action *mask,
+ struct mlx5_hw_actions *acts,
+ uint16_t action_src, uint16_t action_dst)
+{
+ int ret = -1;
+ const struct rte_flow_action_indirect_list *mask_conf = mask->conf;
+ struct mlx5_priv *priv = dev->data->dev_private;
+
+ if (mask_conf && mask_conf->handle && !mask_conf->conf)
+ /**
+ * If handle was masked, assign fixed DR action.
+ */
+ ret = flow_hw_reformat_action(dev, NULL, action,
+ &acts->rule_acts[action_dst]);
+ else if (mask_conf && !mask_conf->handle && !mask_conf->conf)
+ ret = flow_hw_act_data_indirect_list_append
+ (priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
+ action_src, action_dst, flow_hw_reformat_action);
+ return ret;
+}
+
static int
flow_dr_set_meter(struct mlx5_priv *priv,
struct mlx5dr_rule_action *dr_rule,
@@ -1628,6 +1671,13 @@ table_template_translate_indirect_list(struct rte_eth_dev *dev,
acts, action_src,
action_dst);
break;
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+ if (list_conf->conf)
+ return -EINVAL;
+ ret = hws_table_tmpl_translate_indirect_reformat(dev, action, mask,
+ acts, action_src,
+ action_dst);
+ break;
default:
return -EINVAL;
}
@@ -4966,6 +5016,7 @@ flow_hw_template_actions_list(struct rte_flow_actions_template *at,
struct mlx5_indlst_legacy *legacy;
struct rte_flow_action_list_handle *handle;
} indlst_obj = { .handle = indlst_conf->handle };
+ enum mlx5dr_action_type type;
switch (list_type) {
case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
@@ -4979,6 +5030,11 @@ flow_hw_template_actions_list(struct rte_flow_actions_template *at,
action_template_set_type(at, action_types, action_src, curr_off,
MLX5DR_ACTION_TYP_DEST_ARRAY);
break;
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+ type = ((struct mlx5_hw_encap_decap_action *)
+ (indlst_conf->handle))->action_type;
+ action_template_set_type(at, action_types, action_src, curr_off, type);
+ break;
default:
DRV_LOG(ERR, "Unsupported indirect list type");
return -EINVAL;
@@ -10055,12 +10111,79 @@ flow_hw_inlist_type_get(const struct rte_flow_action *actions)
return actions[1].type == RTE_FLOW_ACTION_TYPE_END ?
MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY :
MLX5_INDIRECT_ACTION_LIST_TYPE_ERR;
+ case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
+ case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
+ return MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT;
default:
break;
}
return MLX5_INDIRECT_ACTION_LIST_TYPE_ERR;
}
+static struct rte_flow_action_list_handle*
+mlx5_hw_decap_encap_handle_create(struct rte_eth_dev *dev,
+ const struct mlx5_flow_template_table_cfg *table_cfg,
+ const struct rte_flow_action *actions,
+ struct rte_flow_error *error)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ const struct rte_flow_attr *flow_attr = &table_cfg->attr.flow_attr;
+ const struct rte_flow_action *encap = NULL;
+ const struct rte_flow_action *decap = NULL;
+ struct rte_flow_indir_action_conf indirect_conf = {
+ .ingress = flow_attr->ingress,
+ .egress = flow_attr->egress,
+ .transfer = flow_attr->transfer,
+ };
+ struct mlx5_hw_encap_decap_action *handle;
+ uint64_t action_flags = 0;
+
+ /*
+ * Allow
+ * 1. raw_decap / raw_encap / end
+ * 2. raw_encap / end
+ * 3. raw_decap / end
+ */
+ while (actions->type != RTE_FLOW_ACTION_TYPE_END) {
+ if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_DECAP) {
+ if (action_flags) {
+ rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+ actions, "Invalid indirect action list sequence");
+ return NULL;
+ }
+ action_flags |= MLX5_FLOW_ACTION_DECAP;
+ decap = actions;
+ } else if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) {
+ if (action_flags & MLX5_FLOW_ACTION_ENCAP) {
+ rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+ actions, "Invalid indirect action list sequence");
+ return NULL;
+ }
+ action_flags |= MLX5_FLOW_ACTION_ENCAP;
+ encap = actions;
+ } else {
+ rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+ actions, "Invalid indirect action type in list");
+ return NULL;
+ }
+ actions++;
+ }
+ if (!decap && !encap) {
+ rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+ actions, "Invalid indirect action combinations");
+ return NULL;
+ }
+ handle = mlx5_reformat_action_create(dev, &indirect_conf, encap, decap, error);
+ if (!handle) {
+ rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+ actions, "Failed to create HWS decap_encap action");
+ return NULL;
+ }
+ handle->indirect.type = MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT;
+ LIST_INSERT_HEAD(&priv->indirect_list_head, &handle->indirect, entry);
+ return (struct rte_flow_action_list_handle *)handle;
+}
+
static struct rte_flow_action_list_handle *
flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
const struct rte_flow_op_attr *attr,
@@ -10112,6 +10235,10 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
handle = mlx5_hw_mirror_handle_create(dev, &table_cfg,
actions, error);
break;
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+ handle = mlx5_hw_decap_encap_handle_create(dev, &table_cfg,
+ actions, error);
+ break;
default:
handle = NULL;
rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
@@ -10171,6 +10298,11 @@ flow_hw_async_action_list_handle_destroy
case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
mlx5_hw_mirror_destroy(dev, (struct mlx5_mirror *)handle);
break;
+ case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+ LIST_REMOVE(&((struct mlx5_hw_encap_decap_action *)handle)->indirect,
+ entry);
+ mlx5_reformat_action_destroy(dev, handle, error);
+ break;
default:
ret = rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
@@ -11468,4 +11600,195 @@ mlx5_flow_hw_put_dr_action(struct rte_eth_dev *dev,
}
}
+static __rte_always_inline uint32_t
+mlx5_reformat_domain_to_tbl_type(const struct rte_flow_indir_action_conf *domain)
+{
+ uint32_t tbl_type;
+
+ if (domain->transfer)
+ tbl_type = MLX5DR_ACTION_FLAG_HWS_FDB;
+ else if (domain->egress)
+ tbl_type = MLX5DR_ACTION_FLAG_HWS_TX;
+ else if (domain->ingress)
+ tbl_type = MLX5DR_ACTION_FLAG_HWS_RX;
+ else
+ tbl_type = UINT32_MAX;
+ return tbl_type;
+}
+
+static struct mlx5_hw_encap_decap_action *
+__mlx5_reformat_create(struct rte_eth_dev *dev,
+ const struct rte_flow_action_raw_encap *encap_conf,
+ const struct rte_flow_indir_action_conf *domain,
+ enum mlx5dr_action_type type)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_hw_encap_decap_action *handle;
+ struct mlx5dr_action_reformat_header hdr;
+ uint32_t flags;
+
+ flags = mlx5_reformat_domain_to_tbl_type(domain);
+ flags |= (uint32_t)MLX5DR_ACTION_FLAG_SHARED;
+ if (flags == UINT32_MAX) {
+ DRV_LOG(ERR, "Reformat: invalid indirect action configuration");
+ return NULL;
+ }
+ /* Allocate new list entry. */
+ handle = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*handle), 0, SOCKET_ID_ANY);
+ if (!handle) {
+ DRV_LOG(ERR, "Reformat: failed to allocate reformat entry");
+ return NULL;
+ }
+ handle->action_type = type;
+ hdr.sz = encap_conf ? encap_conf->size : 0;
+ hdr.data = encap_conf ? encap_conf->data : NULL;
+ handle->action = mlx5dr_action_create_reformat(priv->dr_ctx,
+ type, 1, &hdr, 0, flags);
+ if (!handle->action) {
+ DRV_LOG(ERR, "Reformat: failed to create reformat action");
+ mlx5_free(handle);
+ return NULL;
+ }
+ return handle;
+}
+
+/**
+ * Create mlx5 reformat action.
+ *
+ * @param[in] dev
+ * Pointer to rte_eth_dev structure.
+ * @param[in] conf
+ * Pointer to the indirect action parameters.
+ * @param[in] encap_action
+ * Pointer to the raw_encap action configuration.
+ * @param[in] decap_action
+ * Pointer to the raw_decap action configuration.
+ * @param[out] error
+ * Pointer to error structure.
+ *
+ * @return
+ * A valid shared action handle in case of success, NULL otherwise and
+ * rte_errno is set.
+ */
+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)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_hw_encap_decap_action *handle;
+ const struct rte_flow_action_raw_encap *encap = NULL;
+ const struct rte_flow_action_raw_decap *decap = NULL;
+ enum mlx5dr_action_type type = MLX5DR_ACTION_TYP_LAST;
+
+ MLX5_ASSERT(!encap_action || encap_action->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP);
+ MLX5_ASSERT(!decap_action || decap_action->type == RTE_FLOW_ACTION_TYPE_RAW_DECAP);
+ if (priv->sh->config.dv_flow_en != 2) {
+ rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: hardware does not support");
+ return NULL;
+ }
+ if (!conf || (conf->transfer + conf->egress + conf->ingress != 1)) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: domain should be specified");
+ return NULL;
+ }
+ if ((encap_action && !encap_action->conf) || (decap_action && !decap_action->conf)) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: missed action configuration");
+ return NULL;
+ }
+ if (encap_action && !decap_action) {
+ encap = (const struct rte_flow_action_raw_encap *)encap_action->conf;
+ if (!encap->size || encap->size > MLX5_ENCAP_MAX_LEN ||
+ encap->size < MLX5_ENCAPSULATION_DECISION_SIZE) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: Invalid encap length");
+ return NULL;
+ }
+ type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2;
+ } else if (decap_action && !encap_action) {
+ decap = (const struct rte_flow_action_raw_decap *)decap_action->conf;
+ if (!decap->size || decap->size < MLX5_ENCAPSULATION_DECISION_SIZE) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: Invalid decap length");
+ return NULL;
+ }
+ type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2;
+ } else if (encap_action && decap_action) {
+ decap = (const struct rte_flow_action_raw_decap *)decap_action->conf;
+ encap = (const struct rte_flow_action_raw_encap *)encap_action->conf;
+ if (decap->size < MLX5_ENCAPSULATION_DECISION_SIZE &&
+ encap->size >= MLX5_ENCAPSULATION_DECISION_SIZE &&
+ encap->size <= MLX5_ENCAP_MAX_LEN) {
+ type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3;
+ } else if (decap->size >= MLX5_ENCAPSULATION_DECISION_SIZE &&
+ encap->size < MLX5_ENCAPSULATION_DECISION_SIZE) {
+ type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2;
+ } else {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: Invalid decap & encap length");
+ return NULL;
+ }
+ } else if (!encap_action && !decap_action) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: Invalid decap & encap configurations");
+ return NULL;
+ }
+ if (!priv->dr_ctx) {
+ rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
+ encap_action, "Reformat: HWS not supported");
+ return NULL;
+ }
+ handle = __mlx5_reformat_create(dev, encap, conf, type);
+ if (!handle) {
+ rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, encap_action,
+ "Reformat: failed to create indirect action");
+ return NULL;
+ }
+ return handle;
+}
+
+/**
+ * Destroy the indirect reformat action.
+ * Release action related resources on the NIC and the memory.
+ * Lock free, (mutex should be acquired by caller).
+ *
+ * @param[in] dev
+ * Pointer to the Ethernet device structure.
+ * @param[in] handle
+ * The indirect action list handle to be removed.
+ * @param[out] error
+ * Perform verbose error reporting if not NULL. Initialized in case of
+ * error only.
+ *
+ * @return
+ * 0 on success, otherwise negative errno value.
+ */
+int
+mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
+ struct rte_flow_action_list_handle *handle,
+ struct rte_flow_error *error)
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+ struct mlx5_hw_encap_decap_action *action;
+
+ action = (struct mlx5_hw_encap_decap_action *)handle;
+ if (!priv->dr_ctx || !action)
+ return rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ACTION, handle,
+ "Reformat: invalid action handle");
+ mlx5dr_action_destroy(action->action);
+ mlx5_free(handle);
+ return 0;
+}
#endif
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2 4/5] net/mlx5: support symmetric RSS hash function
2023-07-02 4:57 ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
2023-07-02 4:57 ` [v2 2/5] app/testpmd: support indirect actions list syntax Itamar Gozlan
2023-07-02 4:57 ` [v2 3/5] net/mlx5: add indirect encap decap support Itamar Gozlan
@ 2023-07-02 4:57 ` Itamar Gozlan
2023-07-04 10:46 ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-07-02 4:57 ` [v2 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
3 siblings, 1 reply; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-02 4:57 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm; +Cc: dev, orika, Xueming Li
From: Xueming Li <xuemingl@nvidia.com>
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.
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index b5b809633c..4fc67c4f36 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -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);
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 5082a7e178..d286cfe864 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -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)) {
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 45f2210ae7..572763decf 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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.
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index e273bd958d..e39afc47ad 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -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 { \
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index bae74fd383..ca2143c7cd 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -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)))
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 5e5ebbe620..3d2d240f43 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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))
diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
index ff48194b9f..bc60dcaeb1 100644
--- a/drivers/net/mlx5/mlx5_rx.h
+++ b/drivers/net/mlx5/mlx5_rx.h
@@ -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 */
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 6e99c4dde4..77936d463a 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -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)
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v2 5/5] net/mlx5/hws: support default miss action on FDB
2023-07-02 4:57 ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
` (2 preceding siblings ...)
2023-07-02 4:57 ` [v2 4/5] net/mlx5: support symmetric RSS hash function Itamar Gozlan
@ 2023-07-02 4:57 ` Itamar Gozlan
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-02 4:57 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm; +Cc: dev, orika
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
drivers/net/mlx5/hws/mlx5dr_table.c | 8 ++------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index a514b82fec..96c0c10cd9 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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;
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index 46c2a47015..2c8b7a2b9e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -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;
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG
2023-07-02 4:57 ` [v2 4/5] net/mlx5: support symmetric RSS hash function Itamar Gozlan
@ 2023-07-04 10:46 ` Itamar Gozlan
2023-07-04 10:46 ` [v1 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 10:46 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
In some places an extra new line was added, remove to
have clean prints.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 01d30b8442..e2db85940c 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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;
}
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index f1ae256a7e..f9f220cc6a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -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;
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 7b01f4c9ec..33d0f2d18e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -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;
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index 830bc08678..bedaedb677 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -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;
}
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v1 2/5] net/mlx5/hws: allow destroying rule resources on error
2023-07-04 10:46 ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
@ 2023-07-04 10:46 ` Itamar Gozlan
2023-07-04 10:46 ` [v1 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
` (2 subsequent siblings)
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 10:46 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 071e1ad769..931c68b160 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -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 */
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v1 3/5] net/mlx5/hws: remove duplicated reformat type
2023-07-04 10:46 ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-07-04 10:46 ` [v1 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
@ 2023-07-04 10:46 ` Itamar Gozlan
2023-07-04 10:46 ` [v1 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-07-04 10:46 ` [v1 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 10:46 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev, Shun Hao
From: Shun Hao <shunh@nvidia.com>
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.
Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7942fb0a8f..7d5af4c9bb 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -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,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index e2db85940c..851cee8802 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -18,8 +18,8 @@
static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_MAX] = {
[MLX5DR_TABLE_TYPE_NIC_RX] = {
BIT(MLX5DR_ACTION_TYP_TAG),
- BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) |
- BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2),
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) |
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_CTR),
@@ -28,8 +28,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_TIR) |
@@ -46,8 +46,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -55,8 +55,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_LAST),
},
[MLX5DR_TABLE_TYPE_FDB] = {
- BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) |
- BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2),
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) |
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_CTR),
@@ -65,8 +65,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_VPORT) |
@@ -292,10 +292,10 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
case MLX5DR_ACTION_TYP_DROP:
attr[i].type = MLX5DV_FLOW_ACTION_DROP;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr[i].type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
attr[i].action = action->flow_action;
@@ -503,7 +503,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
attr->dest_tir_num = obj->id;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
if (action->modify_header.num_of_actions == 1) {
@@ -529,14 +529,14 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
attr->dest_table_id = action->root_tbl.sa->id;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_REMOVE;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW5;
attr->remove_header.decap = 1;
attr->remove_header.start_anchor = MLX5_HEADER_ANCHOR_PACKET_START;
attr->remove_header.end_anchor = MLX5_HEADER_ANCHOR_INNER_MAC;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
attr->insert_header.encap = 1;
@@ -544,7 +544,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->insert_header.arg_id = action->reformat.arg_obj->id;
attr->insert_header.header_size = action->reformat.header_size;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
attr->insert_header.encap = 1;
@@ -1128,49 +1128,24 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags)
return NULL;
}
-static int
-mlx5dr_action_conv_reformat_type_to_action(uint32_t reformat_type,
- enum mlx5dr_action_type *action_type)
-{
- switch (reformat_type) {
- case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2:
- *action_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2:
- *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2:
- *action_type = MLX5DR_ACTION_TYP_TNL_L3_TO_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3:
- *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L3;
- break;
- default:
- DR_LOG(ERR, "Invalid reformat type requested");
- rte_errno = ENOTSUP;
- return rte_errno;
- }
- return 0;
-}
-
static void
mlx5dr_action_conv_reformat_to_verbs(uint32_t action_type,
uint32_t *verb_reformat_type)
{
switch (action_type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL;
break;
@@ -1470,16 +1445,16 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_context *ctx,
int ret;
switch (action->type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
ret = mlx5dr_action_create_stcs(action, NULL);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
ret = mlx5dr_action_handle_l2_to_tunnel_l2(ctx, data_sz, data, bulk_size, action);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
ret = mlx5dr_action_handle_l2_to_tunnel_l3(ctx, data_sz, data, bulk_size, action);
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
ret = mlx5dr_action_handle_tunnel_l3_to_l2(ctx, data_sz, data, bulk_size, action);
break;
@@ -1494,21 +1469,16 @@ mlx5dr_action_create_reformat_hws(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,
uint32_t flags)
{
- enum mlx5dr_action_type action_type;
struct mlx5dr_action *action;
int ret;
- ret = mlx5dr_action_conv_reformat_type_to_action(reformat_type, &action_type);
- if (ret)
- return NULL;
-
- action = mlx5dr_action_create_generic(ctx, flags, action_type);
+ action = mlx5dr_action_create_generic(ctx, flags, reformat_type);
if (!action)
return NULL;
@@ -1712,7 +1682,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
case MLX5DR_ACTION_TYP_DROP:
case MLX5DR_ACTION_TYP_CTR:
case MLX5DR_ACTION_TYP_FT:
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
case MLX5DR_ACTION_TYP_ASO_METER:
case MLX5DR_ACTION_TYP_ASO_CT:
case MLX5DR_ACTION_TYP_PUSH_VLAN:
@@ -1726,18 +1696,18 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
mlx5dr_action_destroy_stcs(action);
mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_POP);
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
mlx5dr_action_destroy_stcs(action);
if (action->modify_header.num_of_actions > 1)
mlx5dr_pat_arg_destroy_modify_header(action->ctx, action);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
mlx5dr_action_destroy_stcs(action);
mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_DECAP);
mlx5dr_cmd_destroy_obj(action->reformat.arg_obj);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
mlx5dr_action_destroy_stcs(action);
mlx5dr_cmd_destroy_obj(action->reformat.arg_obj);
break;
@@ -1747,10 +1717,10 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
static void mlx5dr_action_destroy_root(struct mlx5dr_action *action)
{
switch (action->type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
ibv_destroy_flow_action(action->flow_action);
break;
@@ -2256,7 +2226,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
/* Single remove header to header */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_MODIFY);
setter->flags |= ASF_SINGLE1 | ASF_REMOVE | ASF_REPARSE;
@@ -2264,7 +2234,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_single = i;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
/* Double insert header with pointer */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE);
setter->flags |= ASF_DOUBLE | ASF_REPARSE;
@@ -2272,7 +2242,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
/* Single remove + Double insert header with pointer */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_DOUBLE);
setter->flags |= ASF_SINGLE1 | ASF_DOUBLE | ASF_REPARSE | ASF_REMOVE;
@@ -2282,7 +2252,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_single = i;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
/* Double modify header list with remove and push inline */
setter = mlx5dr_action_setter_find_first(last_setter,
ASF_DOUBLE | ASF_REMOVE);
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index d249f8d869..5064b23b7d 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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",
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index bedaedb677..309a61d477 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -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++) {
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 330386df77..e1adc081c1 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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) {
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v1 4/5] net/mlx5/hws: renaming FT to TBL
2023-07-04 10:46 ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-07-04 10:46 ` [v1 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-07-04 10:46 ` [v1 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
@ 2023-07-04 10:46 ` Itamar Gozlan
2023-07-04 10:46 ` [v1 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
3 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 10:46 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
An action naming change is made to describe the action better
and avoid implicit meaning.
Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7d5af4c9bb..ec2230d136 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -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,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 851cee8802..74f4e60863 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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:
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 5064b23b7d..48810142a0 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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",
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index e1adc081c1..521df9ff40 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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];
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v1 5/5] net/mlx5/hws: support default miss action on FDB
2023-07-04 10:46 ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
` (2 preceding siblings ...)
2023-07-04 10:46 ` [v1 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
@ 2023-07-04 10:46 ` Itamar Gozlan
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
3 siblings, 1 reply; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 10:46 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
drivers/net/mlx5/hws/mlx5dr_table.c | 6 +-----
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 74f4e60863..920099ba5b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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;
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index c18ee7c552..f91f04d924 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -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);
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG
2023-07-04 10:46 ` [v1 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
@ 2023-07-04 16:04 ` Itamar Gozlan
2023-07-04 16:04 ` [v3 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
` (4 more replies)
0 siblings, 5 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 16:04 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
In some places an extra new line was added, remove to
have clean prints.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 01d30b8442..e2db85940c 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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;
}
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index f1ae256a7e..f9f220cc6a 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -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;
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 7b01f4c9ec..33d0f2d18e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -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;
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index 830bc08678..bedaedb677 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -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;
}
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v3 2/5] net/mlx5/hws: allow destroying rule resources on error
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
@ 2023-07-04 16:04 ` Itamar Gozlan
2023-07-04 16:04 ` [v3 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
` (3 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 16:04 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 071e1ad769..931c68b160 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -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 */
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v3 3/5] net/mlx5/hws: remove duplicated reformat type
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
2023-07-04 16:04 ` [v3 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
@ 2023-07-04 16:04 ` Itamar Gozlan
2023-07-04 16:04 ` [v3 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
` (2 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 16:04 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev, Shun Hao
From: Shun Hao <shunh@nvidia.com>
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.
Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7942fb0a8f..7d5af4c9bb 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -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,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index e2db85940c..851cee8802 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -18,8 +18,8 @@
static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_MAX] = {
[MLX5DR_TABLE_TYPE_NIC_RX] = {
BIT(MLX5DR_ACTION_TYP_TAG),
- BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) |
- BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2),
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) |
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_CTR),
@@ -28,8 +28,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_TIR) |
@@ -46,8 +46,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_DROP) |
@@ -55,8 +55,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_LAST),
},
[MLX5DR_TABLE_TYPE_FDB] = {
- BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) |
- BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2),
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) |
+ BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_POP_VLAN),
BIT(MLX5DR_ACTION_TYP_CTR),
@@ -65,8 +65,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_PUSH_VLAN),
BIT(MLX5DR_ACTION_TYP_MODIFY_HDR),
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) |
- BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3),
+ 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_MISS) |
BIT(MLX5DR_ACTION_TYP_VPORT) |
@@ -292,10 +292,10 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
case MLX5DR_ACTION_TYP_DROP:
attr[i].type = MLX5DV_FLOW_ACTION_DROP;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr[i].type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
attr[i].action = action->flow_action;
@@ -503,7 +503,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
attr->dest_tir_num = obj->id;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
if (action->modify_header.num_of_actions == 1) {
@@ -529,14 +529,14 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
attr->dest_table_id = action->root_tbl.sa->id;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_REMOVE;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW5;
attr->remove_header.decap = 1;
attr->remove_header.start_anchor = MLX5_HEADER_ANCHOR_PACKET_START;
attr->remove_header.end_anchor = MLX5_HEADER_ANCHOR_INNER_MAC;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
attr->insert_header.encap = 1;
@@ -544,7 +544,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
attr->insert_header.arg_id = action->reformat.arg_obj->id;
attr->insert_header.header_size = action->reformat.header_size;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT;
attr->action_offset = MLX5DR_ACTION_OFFSET_DW6;
attr->insert_header.encap = 1;
@@ -1128,49 +1128,24 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags)
return NULL;
}
-static int
-mlx5dr_action_conv_reformat_type_to_action(uint32_t reformat_type,
- enum mlx5dr_action_type *action_type)
-{
- switch (reformat_type) {
- case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2:
- *action_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2:
- *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2:
- *action_type = MLX5DR_ACTION_TYP_TNL_L3_TO_L2;
- break;
- case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3:
- *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L3;
- break;
- default:
- DR_LOG(ERR, "Invalid reformat type requested");
- rte_errno = ENOTSUP;
- return rte_errno;
- }
- return 0;
-}
-
static void
mlx5dr_action_conv_reformat_to_verbs(uint32_t action_type,
uint32_t *verb_reformat_type)
{
switch (action_type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
*verb_reformat_type =
MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL;
break;
@@ -1470,16 +1445,16 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_context *ctx,
int ret;
switch (action->type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
ret = mlx5dr_action_create_stcs(action, NULL);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
ret = mlx5dr_action_handle_l2_to_tunnel_l2(ctx, data_sz, data, bulk_size, action);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
ret = mlx5dr_action_handle_l2_to_tunnel_l3(ctx, data_sz, data, bulk_size, action);
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
ret = mlx5dr_action_handle_tunnel_l3_to_l2(ctx, data_sz, data, bulk_size, action);
break;
@@ -1494,21 +1469,16 @@ mlx5dr_action_create_reformat_hws(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,
uint32_t flags)
{
- enum mlx5dr_action_type action_type;
struct mlx5dr_action *action;
int ret;
- ret = mlx5dr_action_conv_reformat_type_to_action(reformat_type, &action_type);
- if (ret)
- return NULL;
-
- action = mlx5dr_action_create_generic(ctx, flags, action_type);
+ action = mlx5dr_action_create_generic(ctx, flags, reformat_type);
if (!action)
return NULL;
@@ -1712,7 +1682,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
case MLX5DR_ACTION_TYP_DROP:
case MLX5DR_ACTION_TYP_CTR:
case MLX5DR_ACTION_TYP_FT:
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
case MLX5DR_ACTION_TYP_ASO_METER:
case MLX5DR_ACTION_TYP_ASO_CT:
case MLX5DR_ACTION_TYP_PUSH_VLAN:
@@ -1726,18 +1696,18 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
mlx5dr_action_destroy_stcs(action);
mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_POP);
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
mlx5dr_action_destroy_stcs(action);
if (action->modify_header.num_of_actions > 1)
mlx5dr_pat_arg_destroy_modify_header(action->ctx, action);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
mlx5dr_action_destroy_stcs(action);
mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_DECAP);
mlx5dr_cmd_destroy_obj(action->reformat.arg_obj);
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
mlx5dr_action_destroy_stcs(action);
mlx5dr_cmd_destroy_obj(action->reformat.arg_obj);
break;
@@ -1747,10 +1717,10 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
static void mlx5dr_action_destroy_root(struct mlx5dr_action *action)
{
switch (action->type) {
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
case MLX5DR_ACTION_TYP_MODIFY_HDR:
ibv_destroy_flow_action(action->flow_action);
break;
@@ -2256,7 +2226,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
- case MLX5DR_ACTION_TYP_TNL_L2_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2:
/* Single remove header to header */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_MODIFY);
setter->flags |= ASF_SINGLE1 | ASF_REMOVE | ASF_REPARSE;
@@ -2264,7 +2234,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_single = i;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2:
/* Double insert header with pointer */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE);
setter->flags |= ASF_DOUBLE | ASF_REPARSE;
@@ -2272,7 +2242,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
break;
- case MLX5DR_ACTION_TYP_L2_TO_TNL_L3:
+ case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
/* Single remove + Double insert header with pointer */
setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_DOUBLE);
setter->flags |= ASF_SINGLE1 | ASF_DOUBLE | ASF_REPARSE | ASF_REMOVE;
@@ -2282,7 +2252,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_single = i;
break;
- case MLX5DR_ACTION_TYP_TNL_L3_TO_L2:
+ case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
/* Double modify header list with remove and push inline */
setter = mlx5dr_action_setter_find_first(last_setter,
ASF_DOUBLE | ASF_REMOVE);
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index d249f8d869..5064b23b7d 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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",
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index bedaedb677..309a61d477 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -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++) {
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 330386df77..e1adc081c1 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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) {
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v3 4/5] net/mlx5/hws: renaming FT to TBL
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
2023-07-04 16:04 ` [v3 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-07-04 16:04 ` [v3 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
@ 2023-07-04 16:04 ` Itamar Gozlan
2023-07-04 16:04 ` [v3 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
2023-07-06 14:57 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Raslan Darawsheh
4 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 16:04 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
An action naming change is made to describe the action better
and avoid implicit meaning.
Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
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(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7d5af4c9bb..ec2230d136 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -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,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 851cee8802..74f4e60863 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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:
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 5064b23b7d..48810142a0 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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",
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index e1adc081c1..521df9ff40 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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];
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [v3 5/5] net/mlx5/hws: support default miss action on FDB
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
` (2 preceding siblings ...)
2023-07-04 16:04 ` [v3 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
@ 2023-07-04 16:04 ` Itamar Gozlan
2023-07-06 14:57 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Raslan Darawsheh
4 siblings, 0 replies; 21+ messages in thread
From: Itamar Gozlan @ 2023-07-04 16:04 UTC (permalink / raw)
To: valex, viacheslavo, matan, thomas, suanmingm, Ori Kam; +Cc: dev
From: Alex Vesker <valex@nvidia.com>
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.
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
drivers/net/mlx5/hws/mlx5dr_table.c | 6 +-----
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 74f4e60863..920099ba5b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -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;
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index c18ee7c552..f91f04d924 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -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);
--
2.18.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
` (3 preceding siblings ...)
2023-07-04 16:04 ` [v3 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
@ 2023-07-06 14:57 ` Raslan Darawsheh
4 siblings, 0 replies; 21+ messages in thread
From: Raslan Darawsheh @ 2023-07-06 14:57 UTC (permalink / raw)
To: Itamar Gozlan, Alex Vesker, Slava Ovsiienko, Matan Azrad,
NBU-Contact-Thomas Monjalon (EXTERNAL),
Suanming Mou, Ori Kam
Cc: dev
Hi,
> -----Original Message-----
> From: Itamar Gozlan <igozlan@nvidia.com>
> Sent: Tuesday, July 4, 2023 7:05 PM
> To: Alex Vesker <valex@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; NBU-
> Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Suanming
> Mou <suanmingm@nvidia.com>; Ori Kam <orika@nvidia.com>
> Cc: dev@dpdk.org
> Subject: [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG
>
> From: Alex Vesker <valex@nvidia.com>
>
> In some places an extra new line was added, remove to have clean prints.
>
> Signed-off-by: Alex Vesker <valex@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
> 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(-)
>
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2023-07-06 14:58 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 7:21 [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-06-29 7:21 ` [PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-06-29 7:21 ` [PATCH 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
2023-06-29 7:21 ` [PATCH 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-06-29 7:21 ` [PATCH 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
2023-07-02 4:57 ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
2023-07-02 4:57 ` [v2 2/5] app/testpmd: support indirect actions list syntax Itamar Gozlan
2023-07-02 4:57 ` [v2 3/5] net/mlx5: add indirect encap decap support Itamar Gozlan
2023-07-02 4:57 ` [v2 4/5] net/mlx5: support symmetric RSS hash function Itamar Gozlan
2023-07-04 10:46 ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-07-04 10:46 ` [v1 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-07-04 10:46 ` [v1 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
2023-07-04 10:46 ` [v1 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-07-04 10:46 ` [v1 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
2023-07-04 16:04 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
2023-07-04 16:04 ` [v3 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-07-04 16:04 ` [v3 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
2023-07-04 16:04 ` [v3 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-07-04 16:04 ` [v3 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
2023-07-06 14:57 ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Raslan Darawsheh
2023-07-02 4:57 ` [v2 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).