net/mlx5/hws: fix shared context to use local defaults
Checks
Commit Message
Fix default miss behavior for shared resources, the problem
could happen in two cases:
When the table created, the default miss should go to the alias ft
that will direct it back to local context.
When the rule is without specific hit address and we are in a shared
RTC from here it should be redirected back to the local context.
Fixes: ce946c7d3999 ("net/mlx5/hws: support ibv context shared with local one")
Cc: stable@dpdk.org
Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_action.c | 9 ++++++++-
drivers/net/mlx5/hws/mlx5dr_table.c | 29 ++++++++++++++++++++++------
2 files changed, 31 insertions(+), 7 deletions(-)
Comments
Hi Erez,
> -----Original Message-----
> From: Erez Shitrit <erezsh@nvidia.com>
> Sent: Wednesday, March 22, 2023 12:16 PM
> To: dev@dpdk.org
> Cc: Alex Vesker <valex@nvidia.com>; stable@dpdk.org; Matan Azrad
> <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Subject: [PATCH] net/mlx5/hws: fix shared context to use local defaults
>
>
Can you describe the problem first?
> Fix default miss behavior for shared resources, the problem
> could happen in two cases:
> When the table created, the default miss should go to the alias ft
> that will direct it back to local context.
>
What is expected and what is currently happening?
> When the rule is without specific hit address and we are in a shared
> RTC from here it should be redirected back to the local context.
>
How does your fix address this issue?
> Fixes: ce946c7d3999 ("net/mlx5/hws: support ibv context shared with local
> one")
> Cc: stable@dpdk.org
>
> Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
> Reviewed-by: Alex Vesker <valex@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
As a general comment,
1- this patch is a V3 of the original series : http://patches.dpdk.org/project/dpdk/list/?series=27465
2- you should be sending it as a reply to v1 and set version numbers in general stating the diff in between the versions.
3- I see only v1 was sent as one series then you decided to send it as one patch at a time is there a reason for that?
4- I'd appreciate it if you can send a V4 that has these details so that it will be clear on what is changing.
Kindest regards,
Raslan Darawsheh
@@ -1751,8 +1751,15 @@ int mlx5dr_action_get_default_stc(struct mlx5dr_context *ctx,
goto free_nop_dw6;
}
- stc_attr.action_type = MLX5_IFC_STC_ACTION_TYPE_ALLOW;
stc_attr.action_offset = MLX5DR_ACTION_OFFSET_HIT;
+ if (!mlx5dr_context_shared_gvmi_used(ctx)) {
+ stc_attr.action_type = MLX5_IFC_STC_ACTION_TYPE_ALLOW;
+ } else {
+ /* On shared gvmi the default hit behavior is jump to alias end ft */
+ stc_attr.action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_FT;
+ stc_attr.dest_table_id = ctx->gvmi_res[tbl_type].aliased_end_ft->id;
+ }
+
ret = mlx5dr_action_alloc_single_stc(ctx, &stc_attr, tbl_type,
&default_stc->default_hit);
if (ret) {
@@ -272,6 +272,9 @@ static void mlx5dr_table_uninit_shared_ctx_res(struct mlx5dr_table *tbl)
/* called under spin_lock ctx->ctrl_lock */
static int mlx5dr_table_init_shared_ctx_res(struct mlx5dr_context *ctx, struct mlx5dr_table *tbl)
{
+ struct mlx5dr_cmd_ft_modify_attr ft_attr = {0};
+ int ret;
+
if (!mlx5dr_context_shared_gvmi_used(ctx))
return 0;
@@ -288,8 +291,22 @@ static int mlx5dr_table_init_shared_ctx_res(struct mlx5dr_context *ctx, struct m
goto clean_local_ft;
}
+ /* On shared gvmi the default behavior is jump to alias end ft */
+ mlx5dr_cmd_set_attr_connect_miss_tbl(tbl->ctx,
+ tbl->fw_ft_type,
+ tbl->type,
+ &ft_attr);
+
+ ret = mlx5dr_cmd_flow_table_modify(tbl->ft, &ft_attr);
+ if (ret) {
+ DR_LOG(ERR, "Failed to point table to its default miss");
+ goto clean_shared_res;
+ }
+
return 0;
+clean_shared_res:
+ mlx5dr_table_put_shared_gvmi_res(tbl);
clean_local_ft:
mlx5dr_table_destroy_default_ft(tbl, tbl->local_ft);
return rte_errno;
@@ -337,20 +354,20 @@ static int mlx5dr_table_init(struct mlx5dr_table *tbl)
return rte_errno;
}
- ret = mlx5dr_action_get_default_stc(ctx, tbl->type);
+ ret = mlx5dr_table_init_shared_ctx_res(ctx, tbl);
if (ret)
goto tbl_destroy;
- ret = mlx5dr_table_init_shared_ctx_res(ctx, tbl);
+ ret = mlx5dr_action_get_default_stc(ctx, tbl->type);
if (ret)
- goto put_stc;
+ goto free_shared_ctx;
pthread_spin_unlock(&ctx->ctrl_lock);
return 0;
-put_stc:
- mlx5dr_action_put_default_stc(ctx, tbl->type);
+free_shared_ctx:
+ mlx5dr_table_uninit_shared_ctx_res(tbl);
tbl_destroy:
mlx5dr_table_destroy_default_ft(tbl, tbl->ft);
pthread_spin_unlock(&ctx->ctrl_lock);
@@ -363,8 +380,8 @@ static void mlx5dr_table_uninit(struct mlx5dr_table *tbl)
return;
pthread_spin_lock(&tbl->ctx->ctrl_lock);
mlx5dr_action_put_default_stc(tbl->ctx, tbl->type);
- mlx5dr_table_destroy_default_ft(tbl, tbl->ft);
mlx5dr_table_uninit_shared_ctx_res(tbl);
+ mlx5dr_table_destroy_default_ft(tbl, tbl->ft);
pthread_spin_unlock(&tbl->ctx->ctrl_lock);
}