Commit 34583bee authored by Erez Shitrit's avatar Erez Shitrit Committed by Saeed Mahameed

net/mlx5: DR, Create multi-destination table for SW-steering use

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: default avatarErez Shitrit <erezsh@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 6de03d2d
......@@ -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);
}
......@@ -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_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment