diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_dcb.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb.c | 219 |
1 files changed, 0 insertions, 219 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb.c b/drivers/net/ixgbe/ixgbe_dcb.c index 9aea4f04bbd2..8bb9ddb6dffe 100644 --- a/drivers/net/ixgbe/ixgbe_dcb.c +++ b/drivers/net/ixgbe/ixgbe_dcb.c | |||
@@ -34,98 +34,6 @@ | |||
34 | #include "ixgbe_dcb_82599.h" | 34 | #include "ixgbe_dcb_82599.h" |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * ixgbe_dcb_config - Struct containing DCB settings. | ||
38 | * @dcb_config: Pointer to DCB config structure | ||
39 | * | ||
40 | * This function checks DCB rules for DCB settings. | ||
41 | * The following rules are checked: | ||
42 | * 1. The sum of bandwidth percentages of all Bandwidth Groups must total 100%. | ||
43 | * 2. The sum of bandwidth percentages of all Traffic Classes within a Bandwidth | ||
44 | * Group must total 100. | ||
45 | * 3. A Traffic Class should not be set to both Link Strict Priority | ||
46 | * and Group Strict Priority. | ||
47 | * 4. Link strict Bandwidth Groups can only have link strict traffic classes | ||
48 | * with zero bandwidth. | ||
49 | */ | ||
50 | s32 ixgbe_dcb_check_config(struct ixgbe_dcb_config *dcb_config) | ||
51 | { | ||
52 | struct tc_bw_alloc *p; | ||
53 | s32 ret_val = 0; | ||
54 | u8 i, j, bw = 0, bw_id; | ||
55 | u8 bw_sum[2][MAX_BW_GROUP]; | ||
56 | bool link_strict[2][MAX_BW_GROUP]; | ||
57 | |||
58 | memset(bw_sum, 0, sizeof(bw_sum)); | ||
59 | memset(link_strict, 0, sizeof(link_strict)); | ||
60 | |||
61 | /* First Tx, then Rx */ | ||
62 | for (i = 0; i < 2; i++) { | ||
63 | /* Check each traffic class for rule violation */ | ||
64 | for (j = 0; j < MAX_TRAFFIC_CLASS; j++) { | ||
65 | p = &dcb_config->tc_config[j].path[i]; | ||
66 | |||
67 | bw = p->bwg_percent; | ||
68 | bw_id = p->bwg_id; | ||
69 | |||
70 | if (bw_id >= MAX_BW_GROUP) { | ||
71 | ret_val = DCB_ERR_CONFIG; | ||
72 | goto err_config; | ||
73 | } | ||
74 | if (p->prio_type == prio_link) { | ||
75 | link_strict[i][bw_id] = true; | ||
76 | /* Link strict should have zero bandwidth */ | ||
77 | if (bw) { | ||
78 | ret_val = DCB_ERR_LS_BW_NONZERO; | ||
79 | goto err_config; | ||
80 | } | ||
81 | } else if (!bw) { | ||
82 | /* | ||
83 | * Traffic classes without link strict | ||
84 | * should have non-zero bandwidth. | ||
85 | */ | ||
86 | ret_val = DCB_ERR_TC_BW_ZERO; | ||
87 | goto err_config; | ||
88 | } | ||
89 | bw_sum[i][bw_id] += bw; | ||
90 | } | ||
91 | |||
92 | bw = 0; | ||
93 | |||
94 | /* Check each bandwidth group for rule violation */ | ||
95 | for (j = 0; j < MAX_BW_GROUP; j++) { | ||
96 | bw += dcb_config->bw_percentage[i][j]; | ||
97 | /* | ||
98 | * Sum of bandwidth percentages of all traffic classes | ||
99 | * within a Bandwidth Group must total 100 except for | ||
100 | * link strict group (zero bandwidth). | ||
101 | */ | ||
102 | if (link_strict[i][j]) { | ||
103 | if (bw_sum[i][j]) { | ||
104 | /* | ||
105 | * Link strict group should have zero | ||
106 | * bandwidth. | ||
107 | */ | ||
108 | ret_val = DCB_ERR_LS_BWG_NONZERO; | ||
109 | goto err_config; | ||
110 | } | ||
111 | } else if (bw_sum[i][j] != BW_PERCENT && | ||
112 | bw_sum[i][j] != 0) { | ||
113 | ret_val = DCB_ERR_TC_BW; | ||
114 | goto err_config; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | if (bw != BW_PERCENT) { | ||
119 | ret_val = DCB_ERR_BW_GROUP; | ||
120 | goto err_config; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | err_config: | ||
125 | return ret_val; | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * ixgbe_dcb_calculate_tc_credits - Calculates traffic class credits | 37 | * ixgbe_dcb_calculate_tc_credits - Calculates traffic class credits |
130 | * @ixgbe_dcb_config: Struct containing DCB settings. | 38 | * @ixgbe_dcb_config: Struct containing DCB settings. |
131 | * @direction: Configuring either Tx or Rx. | 39 | * @direction: Configuring either Tx or Rx. |
@@ -203,133 +111,6 @@ out: | |||
203 | } | 111 | } |
204 | 112 | ||
205 | /** | 113 | /** |
206 | * ixgbe_dcb_get_tc_stats - Returns status of each traffic class | ||
207 | * @hw: pointer to hardware structure | ||
208 | * @stats: pointer to statistics structure | ||
209 | * @tc_count: Number of elements in bwg_array. | ||
210 | * | ||
211 | * This function returns the status data for each of the Traffic Classes in use. | ||
212 | */ | ||
213 | s32 ixgbe_dcb_get_tc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, | ||
214 | u8 tc_count) | ||
215 | { | ||
216 | s32 ret = 0; | ||
217 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
218 | ret = ixgbe_dcb_get_tc_stats_82598(hw, stats, tc_count); | ||
219 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
220 | ret = ixgbe_dcb_get_tc_stats_82599(hw, stats, tc_count); | ||
221 | return ret; | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * ixgbe_dcb_get_pfc_stats - Returns CBFC status of each traffic class | ||
226 | * hw - pointer to hardware structure | ||
227 | * stats - pointer to statistics structure | ||
228 | * tc_count - Number of elements in bwg_array. | ||
229 | * | ||
230 | * This function returns the CBFC status data for each of the Traffic Classes. | ||
231 | */ | ||
232 | s32 ixgbe_dcb_get_pfc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, | ||
233 | u8 tc_count) | ||
234 | { | ||
235 | s32 ret = 0; | ||
236 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
237 | ret = ixgbe_dcb_get_pfc_stats_82598(hw, stats, tc_count); | ||
238 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
239 | ret = ixgbe_dcb_get_pfc_stats_82599(hw, stats, tc_count); | ||
240 | return ret; | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * ixgbe_dcb_config_rx_arbiter - Config Rx arbiter | ||
245 | * @hw: pointer to hardware structure | ||
246 | * @dcb_config: pointer to ixgbe_dcb_config structure | ||
247 | * | ||
248 | * Configure Rx Data Arbiter and credits for each traffic class. | ||
249 | */ | ||
250 | s32 ixgbe_dcb_config_rx_arbiter(struct ixgbe_hw *hw, | ||
251 | struct ixgbe_dcb_config *dcb_config) | ||
252 | { | ||
253 | s32 ret = 0; | ||
254 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
255 | ret = ixgbe_dcb_config_rx_arbiter_82598(hw, dcb_config); | ||
256 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
257 | ret = ixgbe_dcb_config_rx_arbiter_82599(hw, dcb_config); | ||
258 | return ret; | ||
259 | } | ||
260 | |||
261 | /** | ||
262 | * ixgbe_dcb_config_tx_desc_arbiter - Config Tx Desc arbiter | ||
263 | * @hw: pointer to hardware structure | ||
264 | * @dcb_config: pointer to ixgbe_dcb_config structure | ||
265 | * | ||
266 | * Configure Tx Descriptor Arbiter and credits for each traffic class. | ||
267 | */ | ||
268 | s32 ixgbe_dcb_config_tx_desc_arbiter(struct ixgbe_hw *hw, | ||
269 | struct ixgbe_dcb_config *dcb_config) | ||
270 | { | ||
271 | s32 ret = 0; | ||
272 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
273 | ret = ixgbe_dcb_config_tx_desc_arbiter_82598(hw, dcb_config); | ||
274 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
275 | ret = ixgbe_dcb_config_tx_desc_arbiter_82599(hw, dcb_config); | ||
276 | return ret; | ||
277 | } | ||
278 | |||
279 | /** | ||
280 | * ixgbe_dcb_config_tx_data_arbiter - Config Tx data arbiter | ||
281 | * @hw: pointer to hardware structure | ||
282 | * @dcb_config: pointer to ixgbe_dcb_config structure | ||
283 | * | ||
284 | * Configure Tx Data Arbiter and credits for each traffic class. | ||
285 | */ | ||
286 | s32 ixgbe_dcb_config_tx_data_arbiter(struct ixgbe_hw *hw, | ||
287 | struct ixgbe_dcb_config *dcb_config) | ||
288 | { | ||
289 | s32 ret = 0; | ||
290 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
291 | ret = ixgbe_dcb_config_tx_data_arbiter_82598(hw, dcb_config); | ||
292 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
293 | ret = ixgbe_dcb_config_tx_data_arbiter_82599(hw, dcb_config); | ||
294 | return ret; | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * ixgbe_dcb_config_pfc - Config priority flow control | ||
299 | * @hw: pointer to hardware structure | ||
300 | * @dcb_config: pointer to ixgbe_dcb_config structure | ||
301 | * | ||
302 | * Configure Priority Flow Control for each traffic class. | ||
303 | */ | ||
304 | s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw, | ||
305 | struct ixgbe_dcb_config *dcb_config) | ||
306 | { | ||
307 | s32 ret = 0; | ||
308 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
309 | ret = ixgbe_dcb_config_pfc_82598(hw, dcb_config); | ||
310 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
311 | ret = ixgbe_dcb_config_pfc_82599(hw, dcb_config); | ||
312 | return ret; | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * ixgbe_dcb_config_tc_stats - Config traffic class statistics | ||
317 | * @hw: pointer to hardware structure | ||
318 | * | ||
319 | * Configure queue statistics registers, all queues belonging to same traffic | ||
320 | * class uses a single set of queue statistics counters. | ||
321 | */ | ||
322 | s32 ixgbe_dcb_config_tc_stats(struct ixgbe_hw *hw) | ||
323 | { | ||
324 | s32 ret = 0; | ||
325 | if (hw->mac.type == ixgbe_mac_82598EB) | ||
326 | ret = ixgbe_dcb_config_tc_stats_82598(hw); | ||
327 | else if (hw->mac.type == ixgbe_mac_82599EB) | ||
328 | ret = ixgbe_dcb_config_tc_stats_82599(hw); | ||
329 | return ret; | ||
330 | } | ||
331 | |||
332 | /** | ||
333 | * ixgbe_dcb_hw_config - Config and enable DCB | 114 | * ixgbe_dcb_hw_config - Config and enable DCB |
334 | * @hw: pointer to hardware structure | 115 | * @hw: pointer to hardware structure |
335 | * @dcb_config: pointer to ixgbe_dcb_config structure | 116 | * @dcb_config: pointer to ixgbe_dcb_config structure |