1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ 3 4 #ifndef __MLX5E_EN_QOS_H 5 #define __MLX5E_EN_QOS_H 6 7 #include <linux/mlx5/driver.h> 8 9 #define MLX5E_QOS_MAX_LEAF_NODES 256 10 11 struct mlx5e_priv; 12 struct mlx5e_channels; 13 struct mlx5e_channel; 14 15 int mlx5e_qos_max_leaf_nodes(struct mlx5_core_dev *mdev); 16 int mlx5e_qos_cur_leaf_nodes(struct mlx5e_priv *priv); 17 18 /* TX datapath API */ 19 int mlx5e_get_txq_by_classid(struct mlx5e_priv *priv, u16 classid); 20 struct mlx5e_txqsq *mlx5e_get_sq(struct mlx5e_priv *priv, int qid); 21 22 /* SQ lifecycle */ 23 int mlx5e_qos_open_queues(struct mlx5e_priv *priv, struct mlx5e_channels *chs); 24 void mlx5e_qos_activate_queues(struct mlx5e_priv *priv); 25 void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c); 26 void mlx5e_qos_close_queues(struct mlx5e_channel *c); 27 28 /* HTB API */ 29 int mlx5e_htb_root_add(struct mlx5e_priv *priv, u16 htb_maj_id, u16 htb_defcls, 30 struct netlink_ext_ack *extack); 31 int mlx5e_htb_root_del(struct mlx5e_priv *priv); 32 int mlx5e_htb_leaf_alloc_queue(struct mlx5e_priv *priv, u16 classid, 33 u32 parent_classid, u64 rate, u64 ceil, 34 struct netlink_ext_ack *extack); 35 int mlx5e_htb_leaf_to_inner(struct mlx5e_priv *priv, u16 classid, u16 child_classid, 36 u64 rate, u64 ceil, struct netlink_ext_ack *extack); 37 int mlx5e_htb_leaf_del(struct mlx5e_priv *priv, u16 *classid, 38 struct netlink_ext_ack *extack); 39 int mlx5e_htb_leaf_del_last(struct mlx5e_priv *priv, u16 classid, bool force, 40 struct netlink_ext_ack *extack); 41 int mlx5e_htb_node_modify(struct mlx5e_priv *priv, u16 classid, u64 rate, u64 ceil, 42 struct netlink_ext_ack *extack); 43 44 #endif 45