1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020 Mellanox Technologies. */
3 
4 #ifndef __MLX5E_DCBNL_H__
5 #define __MLX5E_DCBNL_H__
6 
7 #ifdef CONFIG_MLX5_CORE_EN_DCB
8 
9 #define MLX5E_MAX_PRIORITY (8)
10 
11 struct mlx5e_cee_config {
12 	/* bw pct for priority group */
13 	u8                         pg_bw_pct[CEE_DCBX_MAX_PGS];
14 	u8                         prio_to_pg_map[CEE_DCBX_MAX_PRIO];
15 	bool                       pfc_setting[CEE_DCBX_MAX_PRIO];
16 	bool                       pfc_enable;
17 };
18 
19 struct mlx5e_dcbx {
20 	enum mlx5_dcbx_oper_mode   mode;
21 	struct mlx5e_cee_config    cee_cfg; /* pending configuration */
22 	u8                         dscp_app_cnt;
23 
24 	/* The only setting that cannot be read from FW */
25 	u8                         tc_tsa[IEEE_8021QAZ_MAX_TCS];
26 	u8                         cap;
27 
28 	/* Buffer configuration */
29 	bool                       manual_buffer;
30 	u32                        cable_len;
31 	u32                        xoff;
32 	u16                        port_buff_cell_sz;
33 };
34 
35 #define MLX5E_MAX_DSCP (64)
36 
37 struct mlx5e_dcbx_dp {
38 	u8                         dscp2prio[MLX5E_MAX_DSCP];
39 	u8                         trust_state;
40 };
41 
42 void mlx5e_dcbnl_build_netdev(struct net_device *netdev);
43 void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv);
44 void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv);
45 void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv);
46 #else
mlx5e_dcbnl_build_netdev(struct net_device * netdev)47 static inline void mlx5e_dcbnl_build_netdev(struct net_device *netdev) {}
mlx5e_dcbnl_initialize(struct mlx5e_priv * priv)48 static inline void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv) {}
mlx5e_dcbnl_init_app(struct mlx5e_priv * priv)49 static inline void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv) {}
mlx5e_dcbnl_delete_app(struct mlx5e_priv * priv)50 static inline void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv) {}
51 #endif
52 
53 #endif /* __MLX5E_DCBNL_H__ */
54