Skip to content

Commit

Permalink
net/mlx5/hws: support default miss action on FDB
Browse files Browse the repository at this point in the history
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>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
alexvesker authored and ovsrobot committed Jul 4, 2023
1 parent 5ef281d commit 0ab9db7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
27 changes: 20 additions & 7 deletions drivers/net/mlx5/hws/mlx5dr_action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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",
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions drivers/net/mlx5/hws/mlx5dr_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 0ab9db7

Please sign in to comment.