1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ 3 4 #ifndef __MLX5E_EN_HTB_H_ 5 #define __MLX5E_EN_HTB_H_ 6 7 #include "qos.h" 8 9 #define MLX5E_QOS_MAX_LEAF_NODES 256 10 11 struct mlx5e_selq; 12 struct mlx5e_htb; 13 14 typedef int (*mlx5e_fp_htb_enumerate)(void *data, u16 qid, u32 hw_id); 15 int mlx5e_htb_enumerate_leaves(struct mlx5e_htb *htb, mlx5e_fp_htb_enumerate callback, void *data); 16 17 int mlx5e_htb_cur_leaf_nodes(struct mlx5e_htb *htb); 18 19 /* TX datapath API */ 20 int mlx5e_htb_get_txq_by_classid(struct mlx5e_htb *htb, u16 classid); 21 22 /* HTB TC handlers */ 23 24 int 25 mlx5e_htb_leaf_alloc_queue(struct mlx5e_htb *htb, u16 classid, 26 u32 parent_classid, u64 rate, u64 ceil, 27 struct netlink_ext_ack *extack); 28 int 29 mlx5e_htb_leaf_to_inner(struct mlx5e_htb *htb, u16 classid, u16 child_classid, 30 u64 rate, u64 ceil, struct netlink_ext_ack *extack); 31 int mlx5e_htb_leaf_del(struct mlx5e_htb *htb, u16 *classid, 32 struct netlink_ext_ack *extack); 33 int 34 mlx5e_htb_leaf_del_last(struct mlx5e_htb *htb, u16 classid, bool force, 35 struct netlink_ext_ack *extack); 36 int 37 mlx5e_htb_node_modify(struct mlx5e_htb *htb, u16 classid, u64 rate, u64 ceil, 38 struct netlink_ext_ack *extack); 39 struct mlx5e_htb *mlx5e_htb_alloc(void); 40 void mlx5e_htb_free(struct mlx5e_htb *htb); 41 int mlx5e_htb_init(struct mlx5e_htb *htb, struct tc_htb_qopt_offload *htb_qopt, 42 struct net_device *netdev, struct mlx5_core_dev *mdev, 43 struct mlx5e_selq *selq, struct mlx5e_priv *priv); 44 void mlx5e_htb_cleanup(struct mlx5e_htb *htb); 45 #endif 46 47