0001
0002
0003
0004 #ifndef __MLX5E_EN_QOS_H
0005 #define __MLX5E_EN_QOS_H
0006
0007 #include <linux/mlx5/driver.h>
0008
0009 #define BYTES_IN_MBIT 125000
0010
0011 struct mlx5e_priv;
0012 struct mlx5e_htb;
0013 struct mlx5e_channels;
0014 struct mlx5e_channel;
0015 struct tc_htb_qopt_offload;
0016
0017 int mlx5e_qos_bytes_rate_check(struct mlx5_core_dev *mdev, u64 nbytes);
0018 int mlx5e_qos_max_leaf_nodes(struct mlx5_core_dev *mdev);
0019
0020
0021 int mlx5e_open_qos_sq(struct mlx5e_priv *priv, struct mlx5e_channels *chs,
0022 u16 node_qid, u32 hw_id);
0023 int mlx5e_activate_qos_sq(void *data, u16 node_qid, u32 hw_id);
0024 void mlx5e_deactivate_qos_sq(struct mlx5e_priv *priv, u16 qid);
0025 void mlx5e_close_qos_sq(struct mlx5e_priv *priv, u16 qid);
0026 void mlx5e_reactivate_qos_sq(struct mlx5e_priv *priv, u16 qid, struct netdev_queue *txq);
0027 void mlx5e_reset_qdisc(struct net_device *dev, u16 qid);
0028
0029 int mlx5e_qos_open_queues(struct mlx5e_priv *priv, struct mlx5e_channels *chs);
0030 void mlx5e_qos_activate_queues(struct mlx5e_priv *priv);
0031 void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c);
0032 void mlx5e_qos_deactivate_all_queues(struct mlx5e_channels *chs);
0033 void mlx5e_qos_close_queues(struct mlx5e_channel *c);
0034 void mlx5e_qos_close_all_queues(struct mlx5e_channels *chs);
0035 int mlx5e_qos_alloc_queues(struct mlx5e_priv *priv, struct mlx5e_channels *chs);
0036
0037
0038 u16 mlx5e_qid_from_qos(struct mlx5e_channels *chs, u16 qid);
0039
0040
0041 int mlx5e_htb_setup_tc(struct mlx5e_priv *priv, struct tc_htb_qopt_offload *htb);
0042
0043
0044 struct mlx5e_mqprio_rl;
0045 struct mlx5e_mqprio_rl *mlx5e_mqprio_rl_alloc(void);
0046 void mlx5e_mqprio_rl_free(struct mlx5e_mqprio_rl *rl);
0047 int mlx5e_mqprio_rl_init(struct mlx5e_mqprio_rl *rl, struct mlx5_core_dev *mdev, u8 num_tc,
0048 u64 max_rate[]);
0049 void mlx5e_mqprio_rl_cleanup(struct mlx5e_mqprio_rl *rl);
0050 int mlx5e_mqprio_rl_get_node_hw_id(struct mlx5e_mqprio_rl *rl, int tc, u32 *hw_id);
0051 #endif