net/mlx5: DR, Align dest FT action creation to API
Function prefix was changed to be similar to other action APIs. In order to support other FW tables the mlx5_flow_table struct was replaced with table id and type. Signed-off-by: Alex Vesker <valex@mellanox.com> Reviewed-by: Erez Shitrit <erezsh@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
988fd6b32d
commit
aec292ee6f
@ -690,9 +690,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
|
||||
|
||||
/* get the relevant addresses */
|
||||
if (!action->dest_tbl.fw_tbl.rx_icm_addr) {
|
||||
ret = mlx5dr_cmd_query_flow_table(action->dest_tbl.fw_tbl.mdev,
|
||||
action->dest_tbl.fw_tbl.ft->type,
|
||||
action->dest_tbl.fw_tbl.ft->id,
|
||||
ret = mlx5dr_cmd_query_flow_table(dmn->mdev,
|
||||
action->dest_tbl.fw_tbl.type,
|
||||
action->dest_tbl.fw_tbl.id,
|
||||
&output);
|
||||
if (!ret) {
|
||||
action->dest_tbl.fw_tbl.tx_icm_addr =
|
||||
@ -982,8 +982,8 @@ dec_ref:
|
||||
}
|
||||
|
||||
struct mlx5dr_action *
|
||||
mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
|
||||
struct mlx5_core_dev *mdev)
|
||||
mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *dmn,
|
||||
struct mlx5_flow_table *ft)
|
||||
{
|
||||
struct mlx5dr_action *action;
|
||||
|
||||
@ -992,8 +992,11 @@ mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
|
||||
return NULL;
|
||||
|
||||
action->dest_tbl.is_fw_tbl = 1;
|
||||
action->dest_tbl.fw_tbl.ft = ft;
|
||||
action->dest_tbl.fw_tbl.mdev = mdev;
|
||||
action->dest_tbl.fw_tbl.type = ft->type;
|
||||
action->dest_tbl.fw_tbl.id = ft->id;
|
||||
action->dest_tbl.fw_tbl.dmn = dmn;
|
||||
|
||||
refcount_inc(&dmn->refcount);
|
||||
|
||||
return action;
|
||||
}
|
||||
@ -1559,7 +1562,9 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action)
|
||||
|
||||
switch (action->action_type) {
|
||||
case DR_ACTION_TYP_FT:
|
||||
if (!action->dest_tbl.is_fw_tbl)
|
||||
if (action->dest_tbl.is_fw_tbl)
|
||||
refcount_dec(&action->dest_tbl.fw_tbl.dmn->refcount);
|
||||
else
|
||||
refcount_dec(&action->dest_tbl.tbl->refcount);
|
||||
break;
|
||||
case DR_ACTION_TYP_TNL_L2_TO_L2:
|
||||
|
@ -743,10 +743,11 @@ struct mlx5dr_action {
|
||||
union {
|
||||
struct mlx5dr_table *tbl;
|
||||
struct {
|
||||
struct mlx5_flow_table *ft;
|
||||
struct mlx5dr_domain *dmn;
|
||||
u32 id;
|
||||
enum fs_flow_table_type type;
|
||||
u64 rx_icm_addr;
|
||||
u64 tx_icm_addr;
|
||||
struct mlx5_core_dev *mdev;
|
||||
} fw_tbl;
|
||||
};
|
||||
} dest_tbl;
|
||||
|
@ -184,13 +184,13 @@ static struct mlx5dr_action *create_vport_action(struct mlx5dr_domain *domain,
|
||||
dest_attr->vport.vhca_id);
|
||||
}
|
||||
|
||||
static struct mlx5dr_action *create_ft_action(struct mlx5_core_dev *dev,
|
||||
static struct mlx5dr_action *create_ft_action(struct mlx5dr_domain *domain,
|
||||
struct mlx5_flow_rule *dst)
|
||||
{
|
||||
struct mlx5_flow_table *dest_ft = dst->dest_attr.ft;
|
||||
|
||||
if (mlx5_dr_is_fw_table(dest_ft->flags))
|
||||
return mlx5dr_create_action_dest_flow_fw_table(dest_ft, dev);
|
||||
return mlx5dr_action_create_dest_flow_fw_table(domain, dest_ft);
|
||||
return mlx5dr_action_create_dest_table(dest_ft->fs_dr_table.dr_table);
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
|
||||
actions[num_actions++] = tmp_action;
|
||||
break;
|
||||
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
|
||||
tmp_action = create_ft_action(dev, dst);
|
||||
tmp_action = create_ft_action(domain, dst);
|
||||
if (!tmp_action) {
|
||||
err = -ENOMEM;
|
||||
goto free_actions;
|
||||
|
@ -75,8 +75,8 @@ struct mlx5dr_action *
|
||||
mlx5dr_action_create_dest_table(struct mlx5dr_table *table);
|
||||
|
||||
struct mlx5dr_action *
|
||||
mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
|
||||
struct mlx5_core_dev *mdev);
|
||||
mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *domain,
|
||||
struct mlx5_flow_table *ft);
|
||||
|
||||
struct mlx5dr_action *
|
||||
mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
|
||||
@ -165,8 +165,8 @@ static inline struct mlx5dr_action *
|
||||
mlx5dr_action_create_dest_table(struct mlx5dr_table *table) { return NULL; }
|
||||
|
||||
static inline struct mlx5dr_action *
|
||||
mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
|
||||
struct mlx5_core_dev *mdev) { return NULL; }
|
||||
mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *domain,
|
||||
struct mlx5_flow_table *ft) { return NULL; }
|
||||
|
||||
static inline struct mlx5dr_action *
|
||||
mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
|
||||
|
Loading…
x
Reference in New Issue
Block a user