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 11struct mlx5e_selq; 12struct mlx5e_htb; 13 14typedef int (*mlx5e_fp_htb_enumerate)(void *data, u16 qid, u32 hw_id); 15int mlx5e_htb_enumerate_leaves(struct mlx5e_htb *htb, mlx5e_fp_htb_enumerate callback, void *data); 16 17int mlx5e_htb_cur_leaf_nodes(struct mlx5e_htb *htb); 18 19/* TX datapath API */ 20int mlx5e_htb_get_txq_by_classid(struct mlx5e_htb *htb, u16 classid); 21 22/* HTB TC handlers */ 23 24int 25mlx5e_htb_leaf_alloc_queue(struct mlx5e_htb *htb, u16 classid, 26 u32 parent_classid, u64 rate, u64 ceil, 27 struct netlink_ext_ack *extack); 28int 29mlx5e_htb_leaf_to_inner(struct mlx5e_htb *htb, u16 classid, u16 child_classid, 30 u64 rate, u64 ceil, struct netlink_ext_ack *extack); 31int mlx5e_htb_leaf_del(struct mlx5e_htb *htb, u16 *classid, 32 struct netlink_ext_ack *extack); 33int 34mlx5e_htb_leaf_del_last(struct mlx5e_htb *htb, u16 classid, bool force, 35 struct netlink_ext_ack *extack); 36int 37mlx5e_htb_node_modify(struct mlx5e_htb *htb, u16 classid, u64 rate, u64 ceil, 38 struct netlink_ext_ack *extack); 39struct mlx5e_htb *mlx5e_htb_alloc(void); 40void mlx5e_htb_free(struct mlx5e_htb *htb); 41int 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); 44void mlx5e_htb_cleanup(struct mlx5e_htb *htb); 45#endif 46 47