RDMA/mlx5: Move function mlx5_core_query_ib_ppcnt() to mlx5_ib
authorChris Mi <cmi@nvidia.com>
Mon, 29 Aug 2022 09:06:04 +0000 (12:06 +0300)
committerLeon Romanovsky <leon@kernel.org>
Mon, 5 Sep 2022 12:09:03 +0000 (15:09 +0300)
This patch doesn't change any functionality, but move one function
to mlx5_ib because it is not used by mlx5_core.

The actual fix is in the next patch.

Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Chris Mi <cmi@nvidia.com>
Link: https://lore.kernel.org/r/fd47b9138412bd94ed30f838026cbb4cf3878150.1661763871.git.leonro@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/mlx5/mad.c
drivers/net/ethernet/mellanox/mlx5/core/port.c
include/linux/mlx5/driver.h

index 293ed709e5ed5dd2efc8c72fa25137cb21b60ad4..d834ec13b1b390ecf9e42e963c1cfa5a3b68d2c2 100644 (file)
@@ -147,6 +147,28 @@ static void pma_cnt_assign(struct ib_pma_portcounters *pma_cnt,
                             vl_15_dropped);
 }
 
+static int query_ib_ppcnt(struct mlx5_core_dev *dev, u8 port_num, void *out,
+                         size_t sz)
+{
+       u32 *in;
+       int err;
+
+       in  = kvzalloc(sz, GFP_KERNEL);
+       if (!in) {
+               err = -ENOMEM;
+               return err;
+       }
+
+       MLX5_SET(ppcnt_reg, in, local_port, port_num);
+
+       MLX5_SET(ppcnt_reg, in, grp, MLX5_INFINIBAND_PORT_COUNTERS_GROUP);
+       err = mlx5_core_access_reg(dev, in, sz, out,
+                                  sz, MLX5_REG_PPCNT, 0, 0);
+
+       kvfree(in);
+       return err;
+}
+
 static int process_pma_cmd(struct mlx5_ib_dev *dev, u32 port_num,
                           const struct ib_mad *in_mad, struct ib_mad *out_mad)
 {
@@ -202,8 +224,7 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u32 port_num,
                        goto done;
                }
 
-               err = mlx5_core_query_ib_ppcnt(mdev, mdev_port_num,
-                                              out_cnt, sz);
+               err = query_ib_ppcnt(mdev, mdev_port_num, out_cnt, sz);
                if (!err)
                        pma_cnt_assign(pma_cnt, out_cnt);
        }
index e1bd54574ea52d6d841090ef0f938ea209bb486e..a1548e6bfb35dadc73b18863da27c89417a9fc3c 100644 (file)
@@ -493,29 +493,6 @@ int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev,
 }
 EXPORT_SYMBOL_GPL(mlx5_query_port_vl_hw_cap);
 
-int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev,
-                            u8 port_num, void *out, size_t sz)
-{
-       u32 *in;
-       int err;
-
-       in  = kvzalloc(sz, GFP_KERNEL);
-       if (!in) {
-               err = -ENOMEM;
-               return err;
-       }
-
-       MLX5_SET(ppcnt_reg, in, local_port, port_num);
-
-       MLX5_SET(ppcnt_reg, in, grp, MLX5_INFINIBAND_PORT_COUNTERS_GROUP);
-       err = mlx5_core_access_reg(dev, in, sz, out,
-                                  sz, MLX5_REG_PPCNT, 0, 0);
-
-       kvfree(in);
-       return err;
-}
-EXPORT_SYMBOL_GPL(mlx5_core_query_ib_ppcnt);
-
 static int mlx5_query_pfcc_reg(struct mlx5_core_dev *dev, u32 *out,
                               u32 out_size)
 {
index 76d7661e3e63d76830126acb51dc8d0eea62e526..432bd202e2fedcc2f36b99ea7a56c81f4711c938 100644 (file)
@@ -1079,8 +1079,6 @@ int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
 void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
 int mlx5_query_odp_caps(struct mlx5_core_dev *dev,
                        struct mlx5_odp_caps *odp_caps);
-int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev,
-                            u8 port_num, void *out, size_t sz);
 
 int mlx5_init_rl_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev);