Add API functions to set and query dropless port mode in mlx5 core.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2017-11-10 13:44:12 +00:00
parent 0e4248a114
commit 27c29bc44b
2 changed files with 42 additions and 0 deletions

View file

@ -966,6 +966,8 @@ int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
u8 mlx5_is_wol_supported(struct mlx5_core_dev *dev);
int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mode);
int mlx5_set_dropless_mode(struct mlx5_core_dev *dev, u16 timeout);
int mlx5_query_dropless_mode(struct mlx5_core_dev *dev, u16 *timeout);
int mlx5_query_wol(struct mlx5_core_dev *dev, u8 *wol_mode);
int mlx5_core_access_pvlc(struct mlx5_core_dev *dev,
struct mlx5_pvlc_reg *pvlc, int write);

View file

@ -459,6 +459,46 @@ int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mode)
}
EXPORT_SYMBOL_GPL(mlx5_set_wol);
int mlx5_query_dropless_mode(struct mlx5_core_dev *dev, u16 *timeout)
{
u32 in[MLX5_ST_SZ_DW(query_delay_drop_params_in)];
u32 out[MLX5_ST_SZ_DW(query_delay_drop_params_out)];
int err = 0;
memset(in, 0, sizeof(in));
memset(out, 0, sizeof(out));
MLX5_SET(query_delay_drop_params_in, in, opcode,
MLX5_CMD_OP_QUERY_DELAY_DROP_PARAMS);
err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
if (err)
return err;
*timeout = MLX5_GET(query_delay_drop_params_out, out,
delay_drop_timeout);
return 0;
}
EXPORT_SYMBOL_GPL(mlx5_query_dropless_mode);
int mlx5_set_dropless_mode(struct mlx5_core_dev *dev, u16 timeout)
{
u32 in[MLX5_ST_SZ_DW(set_delay_drop_params_in)];
u32 out[MLX5_ST_SZ_DW(set_delay_drop_params_out)];
memset(in, 0, sizeof(in));
memset(out, 0, sizeof(out));
MLX5_SET(set_delay_drop_params_in, in, opcode,
MLX5_CMD_OP_SET_DELAY_DROP_PARAMS);
MLX5_SET(set_delay_drop_params_in, in, delay_drop_timeout, timeout);
return mlx5_cmd_exec_check_status(dev, in, sizeof(in),
out, sizeof(out));
}
EXPORT_SYMBOL_GPL(mlx5_set_dropless_mode);
int mlx5_core_access_pvlc(struct mlx5_core_dev *dev,
struct mlx5_pvlc_reg *pvlc, int write)
{