mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-20 04:44:26 +08:00
net/mlx5: Update ecpf.c to new cmd interface
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>
This commit is contained in:
parent
e36fb468d2
commit
9aa536ad45
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user