1
2
3
4 #ifndef _DCB_CONFIG_H_
5 #define _DCB_CONFIG_H_
6
7 #include <linux/dcbnl.h>
8 #include "ixgbe_type.h"
9
10
11
12 #define IXGBE_MAX_PACKET_BUFFERS 8
13 #define MAX_USER_PRIORITY 8
14 #define MAX_BW_GROUP 8
15 #define BW_PERCENT 100
16
17 #define DCB_TX_CONFIG 0
18 #define DCB_RX_CONFIG 1
19
20
21 #define DCB_SUCCESS 0
22 #define DCB_ERR_CONFIG -1
23 #define DCB_ERR_PARAM -2
24
25
26
27 #define DCB_ERR_BW_GROUP -3
28
29 #define DCB_ERR_TC_BW -4
30
31 #define DCB_ERR_LS_GS -5
32
33 #define DCB_ERR_LS_BW_NONZERO -6
34
35 #define DCB_ERR_LS_BWG_NONZERO -7
36
37 #define DCB_ERR_TC_BW_ZERO -8
38
39 #define DCB_NOT_IMPLEMENTED 0x7FFFFFFF
40
41 struct dcb_pfc_tc_debug {
42 u8 tc;
43 u8 pause_status;
44 u64 pause_quanta;
45 };
46
47 enum strict_prio_type {
48 prio_none = 0,
49 prio_group,
50 prio_link
51 };
52
53
54 #define IXGBE_DCB_PG_SUPPORT 0x00000001
55 #define IXGBE_DCB_PFC_SUPPORT 0x00000002
56 #define IXGBE_DCB_BCN_SUPPORT 0x00000004
57 #define IXGBE_DCB_UP2TC_SUPPORT 0x00000008
58 #define IXGBE_DCB_GSP_SUPPORT 0x00000010
59
60 #define IXGBE_DCB_8_TC_SUPPORT 0x80
61
62 struct dcb_support {
63
64 u32 capabilities;
65
66
67
68
69 u8 traffic_classes;
70 u8 pfc_traffic_classes;
71 };
72
73
74 struct tc_bw_alloc {
75 u8 bwg_id;
76 u8 bwg_percent;
77 u8 link_percent;
78 u8 up_to_tc_bitmap;
79 u16 data_credits_refill;
80 u16 data_credits_max;
81
82 enum strict_prio_type prio_type;
83 };
84
85 enum dcb_pfc_type {
86 pfc_disabled = 0,
87 pfc_enabled_full,
88 pfc_enabled_tx,
89 pfc_enabled_rx
90 };
91
92
93 struct tc_configuration {
94 struct tc_bw_alloc path[2];
95 enum dcb_pfc_type dcb_pfc;
96
97 u16 desc_credits_max;
98 u8 tc;
99 };
100
101 struct dcb_num_tcs {
102 u8 pg_tcs;
103 u8 pfc_tcs;
104 };
105
106 struct ixgbe_dcb_config {
107 struct dcb_support support;
108 struct dcb_num_tcs num_tcs;
109 struct tc_configuration tc_config[MAX_TRAFFIC_CLASS];
110 u8 bw_percentage[2][MAX_BW_GROUP];
111 bool pfc_mode_enable;
112
113 u32 dcb_cfg_version;
114 u32 link_speed;
115 };
116
117
118 void ixgbe_dcb_unpack_pfc(struct ixgbe_dcb_config *cfg, u8 *pfc_en);
119 void ixgbe_dcb_unpack_refill(struct ixgbe_dcb_config *, int, u16 *);
120 void ixgbe_dcb_unpack_max(struct ixgbe_dcb_config *, u16 *);
121 void ixgbe_dcb_unpack_bwgid(struct ixgbe_dcb_config *, int, u8 *);
122 void ixgbe_dcb_unpack_prio(struct ixgbe_dcb_config *, int, u8 *);
123 void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *, int, u8 *);
124 u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *, int, u8);
125
126
127 s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *,
128 struct ixgbe_dcb_config *, int, u8);
129
130
131 s32 ixgbe_dcb_hw_ets(struct ixgbe_hw *hw, struct ieee_ets *ets, int max);
132 s32 ixgbe_dcb_hw_ets_config(struct ixgbe_hw *hw, u16 *refill, u16 *max,
133 u8 *bwg_id, u8 *prio_type, u8 *tc_prio);
134 s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en, u8 *tc_prio);
135 s32 ixgbe_dcb_hw_config(struct ixgbe_hw *, struct ixgbe_dcb_config *);
136
137 void ixgbe_dcb_read_rtrup2tc(struct ixgbe_hw *hw, u8 *map);
138
139
140 #define DCB_CREDIT_QUANTUM 64
141 #define MAX_CREDIT_REFILL 511
142 #define DCB_MAX_TSO_SIZE (32*1024)
143 #define MINIMUM_CREDIT_FOR_TSO (DCB_MAX_TSO_SIZE/64 + 1)
144 #define MAX_CREDIT 4095
145
146 #endif