1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */
3 
4 #ifndef __MLX5_QOS_H
5 #define __MLX5_QOS_H
6 
7 #include "mlx5_core.h"
8 
9 #define MLX5_DEBUG_QOS_MASK BIT(4)
10 
11 #define qos_err(mdev, fmt, ...) \
12 	mlx5_core_err(mdev, "QoS: " fmt, ##__VA_ARGS__)
13 #define qos_warn(mdev, fmt, ...) \
14 	mlx5_core_warn(mdev, "QoS: " fmt, ##__VA_ARGS__)
15 #define qos_dbg(mdev, fmt, ...) \
16 	mlx5_core_dbg_mask(mdev, MLX5_DEBUG_QOS_MASK, "QoS: " fmt, ##__VA_ARGS__)
17 
18 bool mlx5_qos_is_supported(struct mlx5_core_dev *mdev);
19 int mlx5_qos_max_leaf_nodes(struct mlx5_core_dev *mdev);
20 
21 int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id,
22 			      u32 bw_share, u32 max_avg_bw, u32 *id);
23 int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id,
24 			       u32 bw_share, u32 max_avg_bw, u32 *id);
25 int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id);
26 int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 bw_share,
27 			 u32 max_avg_bw, u32 id);
28 int mlx5_qos_destroy_node(struct mlx5_core_dev *mdev, u32 id);
29 
30 #endif
31