]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/mlx5: DR, Align dest FT action creation to API
authorAlex Vesker <valex@mellanox.com>
Sun, 15 Dec 2019 19:15:15 +0000 (21:15 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 7 Jan 2020 18:42:36 +0000 (10:42 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h

index 004c56c2fc0cba29cc53de5200939a9003969f05..3e2318761c8cf4a885960bccc47dd04b1e346ba1 100644 (file)
@@ -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 @@ mlx5dr_action_create_dest_table(struct mlx5dr_table *tbl)
 }
 
 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:
index de6bfa655326a2d13dac43012782867748150b11..27f1d931bf9fe70e54925cbdb49b94aa36d96632 100644 (file)
@@ -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;
index 8ed0f087b1e0560cb1f53be3ff67aa8cf8fd1b73..e51262ec77bbe11c7ae310b7252c84f4d3b63c93 100644 (file)
@@ -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;
index fb3ac697df1b7190ed19e3d14230c6d6062935a9..932362d89c66ac357194dfcdf4ec0bf0d6a538f8 100644 (file)
@@ -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,