From owner-svn-src-stable-11@freebsd.org Tue Feb 13 14:47:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19842F062C3; Tue, 13 Feb 2018 14:47:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF57B7C102; Tue, 13 Feb 2018 14:47:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA47122262; Tue, 13 Feb 2018 14:47:44 +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 w1DElirw009575; Tue, 13 Feb 2018 14:47:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEliRG009573; Tue, 13 Feb 2018 14:47:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131447.w1DEliRG009573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329203 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:47:45 -0000 Author: hselasky Date: Tue Feb 13 14:47:44 2018 New Revision: 329203 URL: https://svnweb.freebsd.org/changeset/base/329203 Log: MFC r325657: Add API function to query port performance counters for infiniband and RoCE traffic in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/11/sys/dev/mlx5/vport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:46:29 2018 (r329202) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:47:44 2018 (r329203) @@ -1757,3 +1757,25 @@ out: return err; } EXPORT_SYMBOL_GPL(mlx5_query_hca_vport_state); + +int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev, + u8 port_num, void *out, size_t sz) +{ + u32 *in; + int err; + + in = mlx5_vzalloc(sz); + if (!in) { + err = -ENOMEM; + return err; + } + + MLX5_SET(ppcnt_reg, in, local_port, port_num); + + MLX5_SET(ppcnt_reg, in, grp, MLX5_INFINIBAND_PORT_COUNTERS_GROUP); + err = mlx5_core_access_reg(dev, in, sz, out, + sz, MLX5_REG_PPCNT, 0, 0); + + kvfree(in); + return err; +} Modified: stable/11/sys/dev/mlx5/vport.h ============================================================================== --- stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:46:29 2018 (r329202) +++ stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:47:44 2018 (r329203) @@ -143,4 +143,6 @@ int mlx5_query_vport_counter(struct mlx5_core_dev *dev void *out, int out_size); int mlx5_get_vport_counters(struct mlx5_core_dev *dev, u8 port_num, struct mlx5_vport_counters *vc); +int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev, + u8 port_num, void *out, size_t sz); #endif /* __MLX5_VPORT_H__ */