From owner-svn-src-head@freebsd.org Fri Nov 10 13:44:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 298A1E6E5F4; Fri, 10 Nov 2017 13:44:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0421873FAE; Fri, 10 Nov 2017 13:44:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAADiDDK009373; Fri, 10 Nov 2017 13:44:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAADiDuL009371; Fri, 10 Nov 2017 13:44:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711101344.vAADiDuL009371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 10 Nov 2017 13:44:12 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 325653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 13:44:14 -0000 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) {