From: Mark Bloch <markb@mellanox.com>
Date: Mon, 1 Jan 2018 13:07:01 +0200
Subject: IB/mlx5: Move hardware counters initialization to the corresponding
stage
Patch-mainline: v4.16-rc1
Git-commit: 5e1e76125152c9e4a963188ff66e773086fb54d2
References: bsc#1103991 FATE#326007
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>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/infiniband/hw/mlx5/main.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4182,11 +4182,6 @@ static int mlx5_ib_stage_caps_init(struc
(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;
@@ -4284,8 +4279,12 @@ static void mlx5_ib_stage_odp_cleanup(st
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;
}