Commit aec292ee authored by Alex Vesker's avatar Alex Vesker Committed by Saeed Mahameed

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: default avatarAlex Vesker <valex@mellanox.com>
Reviewed-by: default avatarErez Shitrit <erezsh@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 988fd6b3
...@@ -690,9 +690,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, ...@@ -690,9 +690,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
/* get the relevant addresses */ /* get the relevant addresses */
if (!action->dest_tbl.fw_tbl.rx_icm_addr) { if (!action->dest_tbl.fw_tbl.rx_icm_addr) {
ret = mlx5dr_cmd_query_flow_table(action->dest_tbl.fw_tbl.mdev, ret = mlx5dr_cmd_query_flow_table(dmn->mdev,
action->dest_tbl.fw_tbl.ft->type, action->dest_tbl.fw_tbl.type,
action->dest_tbl.fw_tbl.ft->id, action->dest_tbl.fw_tbl.id,
&output); &output);
if (!ret) { if (!ret) {
action->dest_tbl.fw_tbl.tx_icm_addr = action->dest_tbl.fw_tbl.tx_icm_addr =
...@@ -982,8 +982,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_table *tbl) ...@@ -982,8 +982,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_table *tbl)
} }
struct mlx5dr_action * struct mlx5dr_action *
mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *dmn,
struct mlx5_core_dev *mdev) struct mlx5_flow_table *ft)
{ {
struct mlx5dr_action *action; struct mlx5dr_action *action;
...@@ -992,8 +992,11 @@ mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, ...@@ -992,8 +992,11 @@ mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
return NULL; return NULL;
action->dest_tbl.is_fw_tbl = 1; action->dest_tbl.is_fw_tbl = 1;
action->dest_tbl.fw_tbl.ft = ft; action->dest_tbl.fw_tbl.type = ft->type;
action->dest_tbl.fw_tbl.mdev = mdev; action->dest_tbl.fw_tbl.id = ft->id;
action->dest_tbl.fw_tbl.dmn = dmn;
refcount_inc(&dmn->refcount);
return action; return action;
} }
...@@ -1559,7 +1562,9 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action) ...@@ -1559,7 +1562,9 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action)
switch (action->action_type) { switch (action->action_type) {
case DR_ACTION_TYP_FT: 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); refcount_dec(&action->dest_tbl.tbl->refcount);
break; break;
case DR_ACTION_TYP_TNL_L2_TO_L2: case DR_ACTION_TYP_TNL_L2_TO_L2:
......
...@@ -743,10 +743,11 @@ struct mlx5dr_action { ...@@ -743,10 +743,11 @@ struct mlx5dr_action {
union { union {
struct mlx5dr_table *tbl; struct mlx5dr_table *tbl;
struct { struct {
struct mlx5_flow_table *ft; struct mlx5dr_domain *dmn;
u32 id;
enum fs_flow_table_type type;
u64 rx_icm_addr; u64 rx_icm_addr;
u64 tx_icm_addr; u64 tx_icm_addr;
struct mlx5_core_dev *mdev;
} fw_tbl; } fw_tbl;
}; };
} dest_tbl; } dest_tbl;
......
...@@ -184,13 +184,13 @@ static struct mlx5dr_action *create_vport_action(struct mlx5dr_domain *domain, ...@@ -184,13 +184,13 @@ static struct mlx5dr_action *create_vport_action(struct mlx5dr_domain *domain,
dest_attr->vport.vhca_id); 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_rule *dst)
{ {
struct mlx5_flow_table *dest_ft = dst->dest_attr.ft; struct mlx5_flow_table *dest_ft = dst->dest_attr.ft;
if (mlx5_dr_is_fw_table(dest_ft->flags)) 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); 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, ...@@ -373,7 +373,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
actions[num_actions++] = tmp_action; actions[num_actions++] = tmp_action;
break; break;
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
tmp_action = create_ft_action(dev, dst); tmp_action = create_ft_action(domain, dst);
if (!tmp_action) { if (!tmp_action) {
err = -ENOMEM; err = -ENOMEM;
goto free_actions; goto free_actions;
......
...@@ -75,8 +75,8 @@ struct mlx5dr_action * ...@@ -75,8 +75,8 @@ struct mlx5dr_action *
mlx5dr_action_create_dest_table(struct mlx5dr_table *table); mlx5dr_action_create_dest_table(struct mlx5dr_table *table);
struct mlx5dr_action * struct mlx5dr_action *
mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *domain,
struct mlx5_core_dev *mdev); struct mlx5_flow_table *ft);
struct mlx5dr_action * struct mlx5dr_action *
mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain, mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
...@@ -165,8 +165,8 @@ static inline struct mlx5dr_action * ...@@ -165,8 +165,8 @@ static inline struct mlx5dr_action *
mlx5dr_action_create_dest_table(struct mlx5dr_table *table) { return NULL; } mlx5dr_action_create_dest_table(struct mlx5dr_table *table) { return NULL; }
static inline struct mlx5dr_action * static inline struct mlx5dr_action *
mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *domain,
struct mlx5_core_dev *mdev) { return NULL; } struct mlx5_flow_table *ft) { return NULL; }
static inline struct mlx5dr_action * static inline struct mlx5dr_action *
mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain, mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
......
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