net/mlx5: Update ecpf.c to new cmd interface
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 9 Apr 2020 08:56:42 +0000 (11:56 +0300)
committerLeon Romanovsky <leonro@mellanox.com>
Thu, 23 Apr 2020 18:42:04 +0000 (21:42 +0300)
Do mass update of ecpf.c to reuse newly introduced
mlx5_cmd_exec_in*() interfaces.

Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/ecpf.c

index d2228e37450f2ecd3ff954d9e17dd645d0df7321..a894ea98c95ad774c0e3d7a8b0c45267d7980817 100644 (file)
@@ -8,33 +8,13 @@ bool mlx5_read_embedded_cpu(struct mlx5_core_dev *dev)
        return (ioread32be(&dev->iseg->initializing) >> MLX5_ECPU_BIT_NUM) & 1;
 }
 
-static int mlx5_peer_pf_enable_hca(struct mlx5_core_dev *dev)
-{
-       u32 out[MLX5_ST_SZ_DW(enable_hca_out)] = {};
-       u32 in[MLX5_ST_SZ_DW(enable_hca_in)]   = {};
-
-       MLX5_SET(enable_hca_in, in, opcode, MLX5_CMD_OP_ENABLE_HCA);
-       MLX5_SET(enable_hca_in, in, function_id, 0);
-       MLX5_SET(enable_hca_in, in, embedded_cpu_function, 0);
-       return mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
-}
-
-static int mlx5_peer_pf_disable_hca(struct mlx5_core_dev *dev)
-{
-       u32 out[MLX5_ST_SZ_DW(disable_hca_out)] = {};
-       u32 in[MLX5_ST_SZ_DW(disable_hca_in)]   = {};
-
-       MLX5_SET(disable_hca_in, in, opcode, MLX5_CMD_OP_DISABLE_HCA);
-       MLX5_SET(disable_hca_in, in, function_id, 0);
-       MLX5_SET(disable_hca_in, in, embedded_cpu_function, 0);
-       return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
-}
-
 static int mlx5_peer_pf_init(struct mlx5_core_dev *dev)
 {
+       u32 in[MLX5_ST_SZ_DW(enable_hca_in)] = {};
        int err;
 
-       err = mlx5_peer_pf_enable_hca(dev);
+       MLX5_SET(enable_hca_in, in, opcode, MLX5_CMD_OP_ENABLE_HCA);
+       err = mlx5_cmd_exec_in(dev, enable_hca, in);
        if (err)
                mlx5_core_err(dev, "Failed to enable peer PF HCA err(%d)\n",
                              err);
@@ -44,9 +24,11 @@ static int mlx5_peer_pf_init(struct mlx5_core_dev *dev)
 
 static void mlx5_peer_pf_cleanup(struct mlx5_core_dev *dev)
 {
+       u32 in[MLX5_ST_SZ_DW(disable_hca_in)] = {};
        int err;
 
-       err = mlx5_peer_pf_disable_hca(dev);
+       MLX5_SET(disable_hca_in, in, opcode, MLX5_CMD_OP_DISABLE_HCA);
+       err = mlx5_cmd_exec_in(dev, disable_hca, in);
        if (err) {
                mlx5_core_err(dev, "Failed to disable peer PF HCA err(%d)\n",
                              err);