Date: Fri, 10 Nov 2017 13:44:12 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325653 - in head/sys/dev/mlx5: . mlx5_core Message-ID: <201711101344.vAADiDuL009371@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Nov 10 13:44:12 2017 New Revision: 325653 URL: https://svnweb.freebsd.org/changeset/base/325653 Log: Add API functions to set and query dropless port mode in mlx5 core. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_port.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Nov 10 13:40:27 2017 (r325652) +++ head/sys/dev/mlx5/driver.h Fri Nov 10 13:44:12 2017 (r325653) @@ -966,6 +966,8 @@ int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, i 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); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Fri Nov 10 13:40:27 2017 (r325652) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Fri Nov 10 13:44:12 2017 (r325653) @@ -459,6 +459,46 @@ int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mod } 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711101344.vAADiDuL009371>