]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
IB/mlx5: Move hardware counters initialization to the corresponding stage
authorMark Bloch <markb@mellanox.com>
Mon, 1 Jan 2018 11:07:01 +0000 (13:07 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 4 Jan 2018 00:26:59 +0000 (17:26 -0700)
Now that we have a stage just for hardware counters, move all relevant
initialization logic into one place.

Signed-off-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/main.c

index 07331613f4234d830ac9c15f58a96ed533e0231a..1a409e7ade806dc1565d49ef0c18335f348ddb67 100644 (file)
@@ -4180,11 +4180,6 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
                        (1ull << IB_USER_VERBS_CMD_DEALLOC_MW);
        }
 
-       if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) {
-               dev->ib_dev.get_hw_stats        = mlx5_ib_get_hw_stats;
-               dev->ib_dev.alloc_hw_stats      = mlx5_ib_alloc_hw_stats;
-       }
-
        if (MLX5_CAP_GEN(mdev, xrc)) {
                dev->ib_dev.alloc_xrcd = mlx5_ib_alloc_xrcd;
                dev->ib_dev.dealloc_xrcd = mlx5_ib_dealloc_xrcd;
@@ -4282,8 +4277,12 @@ static void mlx5_ib_stage_odp_cleanup(struct mlx5_ib_dev *dev)
 
 static int mlx5_ib_stage_counters_init(struct mlx5_ib_dev *dev)
 {
-       if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
-               return  mlx5_ib_alloc_counters(dev);
+       if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) {
+               dev->ib_dev.get_hw_stats        = mlx5_ib_get_hw_stats;
+               dev->ib_dev.alloc_hw_stats      = mlx5_ib_alloc_hw_stats;
+
+               return mlx5_ib_alloc_counters(dev);
+       }
 
        return 0;
 }