xref: /freebsd/sys/dev/mlx5/mlx5_core/diag_cnt.h (revision aa7bbdab)
1aa7bbdabSHans Petter Selasky /*-
2aa7bbdabSHans Petter Selasky  * Copyright (c) 2018, Mellanox Technologies, Ltd.
3aa7bbdabSHans Petter Selasky  *
4aa7bbdabSHans Petter Selasky  * Redistribution and use in source and binary forms, with or without
5aa7bbdabSHans Petter Selasky  * modification, are permitted provided that the following conditions
6aa7bbdabSHans Petter Selasky  * are met:
7aa7bbdabSHans Petter Selasky  * 1. Redistributions of source code must retain the above copyright
8aa7bbdabSHans Petter Selasky  *    notice, this list of conditions and the following disclaimer.
9aa7bbdabSHans Petter Selasky  * 2. Redistributions in binary form must reproduce the above copyright
10aa7bbdabSHans Petter Selasky  *    notice, this list of conditions and the following disclaimer in the
11aa7bbdabSHans Petter Selasky  *    documentation and/or other materials provided with the distribution.
12aa7bbdabSHans Petter Selasky  *
13aa7bbdabSHans Petter Selasky  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND
14aa7bbdabSHans Petter Selasky  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15aa7bbdabSHans Petter Selasky  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16aa7bbdabSHans Petter Selasky  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17aa7bbdabSHans Petter Selasky  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18aa7bbdabSHans Petter Selasky  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19aa7bbdabSHans Petter Selasky  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20aa7bbdabSHans Petter Selasky  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21aa7bbdabSHans Petter Selasky  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22aa7bbdabSHans Petter Selasky  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23aa7bbdabSHans Petter Selasky  * SUCH DAMAGE.
24aa7bbdabSHans Petter Selasky  */
25aa7bbdabSHans Petter Selasky 
26aa7bbdabSHans Petter Selasky #ifndef __MLX5_DIAG_CNT_H__
27aa7bbdabSHans Petter Selasky #define	__MLX5_DIAG_CNT_H__
28aa7bbdabSHans Petter Selasky 
29aa7bbdabSHans Petter Selasky #include <dev/mlx5/driver.h>
30aa7bbdabSHans Petter Selasky #include <dev/mlx5/mlx5_core/mlx5_core.h>
31aa7bbdabSHans Petter Selasky 
32aa7bbdabSHans Petter Selasky #define	MLX5_DIAG_CNT_SUPPORTED(mdev) \
33aa7bbdabSHans Petter Selasky 	(MLX5_CAP_GEN(mdev, debug) && \
34aa7bbdabSHans Petter Selasky 	 MLX5_CAP_GEN(mdev, num_of_diagnostic_counters))
35aa7bbdabSHans Petter Selasky 
36aa7bbdabSHans Petter Selasky int	mlx5_diag_cnt_init(struct mlx5_core_dev *);
37aa7bbdabSHans Petter Selasky void	mlx5_diag_cnt_cleanup(struct mlx5_core_dev *);
38aa7bbdabSHans Petter Selasky 
39aa7bbdabSHans Petter Selasky int	mlx5_diag_query_params(struct mlx5_core_dev *);
40aa7bbdabSHans Petter Selasky int	mlx5_diag_set_params(struct mlx5_core_dev *);
41aa7bbdabSHans Petter Selasky int	mlx5_diag_query_counters(struct mlx5_core_dev *, u8 * *out_buffer);
42aa7bbdabSHans Petter Selasky 
43aa7bbdabSHans Petter Selasky #endif					/* __MLX5_DIAG_CNT_H__ */
44