Skip to content

Commit

Permalink
net/mlx5: DR, Create multi-destination table for SW-steering use
Browse files Browse the repository at this point in the history
Currently SW steering doesn't have the means to access HW iterators to
support multi-destination (FTEs) flow table entries.

In order to support multi-destination FTEs for port-mirroring, SW
steering will create a dedicated multi-destination FW managed flow table
and FTEs via direct FW commands that we introduced in the previous patch.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Erez Shitrit authored and Saeed Mahameed committed Jan 7, 2020
1 parent 6de03d2 commit 34583be
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
67 changes: 67 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,70 @@ void mlx5dr_fw_destroy_recalc_cs_ft(struct mlx5dr_domain *dmn,

kfree(recalc_cs_ft);
}

int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
struct mlx5dr_cmd_flow_destination_hw_info *dest,
int num_dest,
bool reformat_req,
u32 *tbl_id,
u32 *group_id)
{
struct mlx5dr_cmd_create_flow_table_attr ft_attr = {};
struct mlx5dr_cmd_fte_info fte_info = {};
u32 val[MLX5_ST_SZ_DW_MATCH_PARAM] = {};
struct mlx5dr_cmd_ft_info ft_info = {};
int ret;

ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB;
ft_attr.level = dmn->info.caps.max_ft_level - 2;
ft_attr.reformat_en = reformat_req;
ft_attr.decap_en = reformat_req;

ret = mlx5dr_cmd_create_flow_table(dmn->mdev, &ft_attr, NULL, tbl_id);
if (ret) {
mlx5dr_err(dmn, "Failed creating multi dest FW flow table %d\n", ret);
return ret;
}

ret = mlx5dr_cmd_create_empty_flow_group(dmn->mdev,
MLX5_FLOW_TABLE_TYPE_FDB,
*tbl_id, group_id);
if (ret) {
mlx5dr_err(dmn, "Failed creating multi dest FW flow group %d\n", ret);
goto free_flow_table;
}

ft_info.id = *tbl_id;
ft_info.type = FS_FT_FDB;
fte_info.action.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
fte_info.dests_size = num_dest;
fte_info.val = val;
fte_info.dest_arr = dest;

ret = mlx5dr_cmd_set_fte(dmn->mdev, 0, 0, &ft_info, *group_id, &fte_info);
if (ret) {
mlx5dr_err(dmn, "Failed setting fte into table %d\n", ret);
goto free_flow_group;
}

return 0;

free_flow_group:
mlx5dr_cmd_destroy_flow_group(dmn->mdev, MLX5_FLOW_TABLE_TYPE_FDB,
*tbl_id, *group_id);
free_flow_table:
mlx5dr_cmd_destroy_flow_table(dmn->mdev, *tbl_id,
MLX5_FLOW_TABLE_TYPE_FDB);
return ret;
}

void mlx5dr_fw_destroy_md_tbl(struct mlx5dr_domain *dmn,
u32 tbl_id, u32 group_id)
{
mlx5dr_cmd_del_flow_table_entry(dmn->mdev, FS_FT_FDB, tbl_id);
mlx5dr_cmd_destroy_flow_group(dmn->mdev,
MLX5_FLOW_TABLE_TYPE_FDB,
tbl_id, group_id);
mlx5dr_cmd_destroy_flow_table(dmn->mdev, tbl_id,
MLX5_FLOW_TABLE_TYPE_FDB);
}
8 changes: 8 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1108,4 +1108,12 @@ void mlx5dr_fw_destroy_recalc_cs_ft(struct mlx5dr_domain *dmn,
int mlx5dr_domain_cache_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn,
u32 vport_num,
u64 *rx_icm_addr);
int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
struct mlx5dr_cmd_flow_destination_hw_info *dest,
int num_dest,
bool reformat_req,
u32 *tbl_id,
u32 *group_id);
void mlx5dr_fw_destroy_md_tbl(struct mlx5dr_domain *dmn, u32 tbl_id,
u32 group_id);
#endif /* _DR_TYPES_H_ */

0 comments on commit 34583be

Please sign in to comment.