qos.h (2121B)
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 11struct mlx5e_priv; 12struct mlx5e_channels; 13struct mlx5e_channel; 14 15int mlx5e_qos_bytes_rate_check(struct mlx5_core_dev *mdev, u64 nbytes); 16int mlx5e_qos_max_leaf_nodes(struct mlx5_core_dev *mdev); 17int mlx5e_qos_cur_leaf_nodes(struct mlx5e_priv *priv); 18 19/* TX datapath API */ 20int mlx5e_get_txq_by_classid(struct mlx5e_priv *priv, u16 classid); 21 22/* SQ lifecycle */ 23int mlx5e_qos_open_queues(struct mlx5e_priv *priv, struct mlx5e_channels *chs); 24void mlx5e_qos_activate_queues(struct mlx5e_priv *priv); 25void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c); 26void mlx5e_qos_close_queues(struct mlx5e_channel *c); 27 28/* HTB API */ 29int mlx5e_htb_root_add(struct mlx5e_priv *priv, u16 htb_maj_id, u16 htb_defcls, 30 struct netlink_ext_ack *extack); 31int mlx5e_htb_root_del(struct mlx5e_priv *priv); 32int 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); 35int mlx5e_htb_leaf_to_inner(struct mlx5e_priv *priv, u16 classid, u16 child_classid, 36 u64 rate, u64 ceil, struct netlink_ext_ack *extack); 37int mlx5e_htb_leaf_del(struct mlx5e_priv *priv, u16 *classid, 38 struct netlink_ext_ack *extack); 39int mlx5e_htb_leaf_del_last(struct mlx5e_priv *priv, u16 classid, bool force, 40 struct netlink_ext_ack *extack); 41int mlx5e_htb_node_modify(struct mlx5e_priv *priv, u16 classid, u64 rate, u64 ceil, 42 struct netlink_ext_ack *extack); 43 44/* MQPRIO TX rate limit */ 45struct mlx5e_mqprio_rl; 46struct mlx5e_mqprio_rl *mlx5e_mqprio_rl_alloc(void); 47void mlx5e_mqprio_rl_free(struct mlx5e_mqprio_rl *rl); 48int mlx5e_mqprio_rl_init(struct mlx5e_mqprio_rl *rl, struct mlx5_core_dev *mdev, u8 num_tc, 49 u64 max_rate[]); 50void mlx5e_mqprio_rl_cleanup(struct mlx5e_mqprio_rl *rl); 51int mlx5e_mqprio_rl_get_node_hw_id(struct mlx5e_mqprio_rl *rl, int tc, u32 *hw_id); 52#endif