aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_dcb_82599.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_dcb_82599.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_82599.c313
1 files changed, 148 insertions, 165 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c
index 25b02fb425ac..d50cf78c234d 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_82599.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 10 Gigabit PCI Express Linux driver 3 Intel 10 Gigabit PCI Express Linux driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2011 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -31,115 +31,79 @@
31#include "ixgbe_dcb_82599.h" 31#include "ixgbe_dcb_82599.h"
32 32
33/** 33/**
34 * ixgbe_dcb_get_tc_stats_82599 - Returns status for each traffic class 34 * ixgbe_dcb_config_packet_buffers_82599 - Configure DCB packet buffers
35 * @hw: pointer to hardware structure 35 * @hw: pointer to hardware structure
36 * @stats: pointer to statistics structure 36 * @rx_pba: method to distribute packet buffer
37 * @tc_count: Number of elements in bwg_array.
38 * 37 *
39 * This function returns the status data for each of the Traffic Classes in use. 38 * Configure packet buffers for DCB mode.
40 */ 39 */
41s32 ixgbe_dcb_get_tc_stats_82599(struct ixgbe_hw *hw, 40static s32 ixgbe_dcb_config_packet_buffers_82599(struct ixgbe_hw *hw, u8 rx_pba)
42 struct ixgbe_hw_stats *stats,
43 u8 tc_count)
44{ 41{
45 int tc; 42 int num_tcs = IXGBE_MAX_PACKET_BUFFERS;
46 43 u32 rx_pb_size = hw->mac.rx_pb_size << IXGBE_RXPBSIZE_SHIFT;
47 if (tc_count > MAX_TRAFFIC_CLASS) 44 u32 rxpktsize;
48 return DCB_ERR_PARAM; 45 u32 txpktsize;
49 /* Statistics pertaining to each traffic class */ 46 u32 txpbthresh;
50 for (tc = 0; tc < tc_count; tc++) { 47 u8 i = 0;
51 /* Transmitted Packets */
52 stats->qptc[tc] += IXGBE_READ_REG(hw, IXGBE_QPTC(tc));
53 /* Transmitted Bytes */
54 stats->qbtc[tc] += IXGBE_READ_REG(hw, IXGBE_QBTC(tc));
55 /* Received Packets */
56 stats->qprc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRC(tc));
57 /* Received Bytes */
58 stats->qbrc[tc] += IXGBE_READ_REG(hw, IXGBE_QBRC(tc));
59 }
60
61 return 0;
62}
63 48
64/** 49 /*
65 * ixgbe_dcb_get_pfc_stats_82599 - Return CBFC status data 50 * This really means configure the first half of the TCs
66 * @hw: pointer to hardware structure 51 * (Traffic Classes) to use 5/8 of the Rx packet buffer
67 * @stats: pointer to statistics structure 52 * space. To determine the size of the buffer for each TC,
68 * @tc_count: Number of elements in bwg_array. 53 * we are multiplying the average size by 5/4 and applying
69 * 54 * it to half of the traffic classes.
70 * This function returns the CBFC status data for each of the Traffic Classes. 55 */
71 */ 56 if (rx_pba == pba_80_48) {
72s32 ixgbe_dcb_get_pfc_stats_82599(struct ixgbe_hw *hw, 57 rxpktsize = (rx_pb_size * 5) / (num_tcs * 4);
73 struct ixgbe_hw_stats *stats, 58 rx_pb_size -= rxpktsize * (num_tcs / 2);
74 u8 tc_count) 59 for (; i < (num_tcs / 2); i++)
75{ 60 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize);
76 int tc;
77
78 if (tc_count > MAX_TRAFFIC_CLASS)
79 return DCB_ERR_PARAM;
80 for (tc = 0; tc < tc_count; tc++) {
81 /* Priority XOFF Transmitted */
82 stats->pxofftxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(tc));
83 /* Priority XOFF Received */
84 stats->pxoffrxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(tc));
85 } 61 }
86 62
87 return 0; 63 /* Divide the remaining Rx packet buffer evenly among the TCs */
88} 64 rxpktsize = rx_pb_size / (num_tcs - i);
65 for (; i < num_tcs; i++)
66 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize);
89 67
90/** 68 /*
91 * ixgbe_dcb_config_packet_buffers_82599 - Configure DCB packet buffers 69 * Setup Tx packet buffer and threshold equally for all TCs
92 * @hw: pointer to hardware structure 70 * TXPBTHRESH register is set in K so divide by 1024 and subtract
93 * @dcb_config: pointer to ixgbe_dcb_config structure 71 * 10 since the largest packet we support is just over 9K.
94 * 72 */
95 * Configure packet buffers for DCB mode. 73 txpktsize = IXGBE_TXPBSIZE_MAX / num_tcs;
96 */ 74 txpbthresh = (txpktsize / 1024) - IXGBE_TXPKT_SIZE_MAX;
97s32 ixgbe_dcb_config_packet_buffers_82599(struct ixgbe_hw *hw, 75 for (i = 0; i < num_tcs; i++) {
98 struct ixgbe_dcb_config *dcb_config) 76 IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), txpktsize);
99{ 77 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), txpbthresh);
100 s32 ret_val = 0; 78 }
101 u32 value = IXGBE_RXPBSIZE_64KB;
102 u8 i = 0;
103 79
104 /* Setup Rx packet buffer sizes */ 80 /* Clear unused TCs, if any, to zero buffer size*/
105 switch (dcb_config->rx_pba_cfg) { 81 for (; i < MAX_TRAFFIC_CLASS; i++) {
106 case pba_80_48: 82 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
107 /* Setup the first four at 80KB */ 83 IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), 0);
108 value = IXGBE_RXPBSIZE_80KB; 84 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), 0);
109 for (; i < 4; i++)
110 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), value);
111 /* Setup the last four at 48KB...don't re-init i */
112 value = IXGBE_RXPBSIZE_48KB;
113 /* Fall Through */
114 case pba_equal:
115 default:
116 for (; i < IXGBE_MAX_PACKET_BUFFERS; i++)
117 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), value);
118
119 /* Setup Tx packet buffer sizes */
120 for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) {
121 IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i),
122 IXGBE_TXPBSIZE_20KB);
123 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i),
124 IXGBE_TXPBTHRESH_DCB);
125 }
126 break;
127 } 85 }
128 86
129 return ret_val; 87 return 0;
130} 88}
131 89
132/** 90/**
133 * ixgbe_dcb_config_rx_arbiter_82599 - Config Rx Data arbiter 91 * ixgbe_dcb_config_rx_arbiter_82599 - Config Rx Data arbiter
134 * @hw: pointer to hardware structure 92 * @hw: pointer to hardware structure
135 * @dcb_config: pointer to ixgbe_dcb_config structure 93 * @refill: refill credits index by traffic class
94 * @max: max credits index by traffic class
95 * @bwg_id: bandwidth grouping indexed by traffic class
96 * @prio_type: priority type indexed by traffic class
136 * 97 *
137 * Configure Rx Packet Arbiter and credits for each traffic class. 98 * Configure Rx Packet Arbiter and credits for each traffic class.
138 */ 99 */
139s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw, 100s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
140 struct ixgbe_dcb_config *dcb_config) 101 u16 *refill,
102 u16 *max,
103 u8 *bwg_id,
104 u8 *prio_type,
105 u8 *prio_tc)
141{ 106{
142 struct tc_bw_alloc *p;
143 u32 reg = 0; 107 u32 reg = 0;
144 u32 credit_refill = 0; 108 u32 credit_refill = 0;
145 u32 credit_max = 0; 109 u32 credit_max = 0;
@@ -155,20 +119,18 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
155 /* Map all traffic classes to their UP, 1 to 1 */ 119 /* Map all traffic classes to their UP, 1 to 1 */
156 reg = 0; 120 reg = 0;
157 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) 121 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
158 reg |= (i << (i * IXGBE_RTRUP2TC_UP_SHIFT)); 122 reg |= (prio_tc[i] << (i * IXGBE_RTRUP2TC_UP_SHIFT));
159 IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, reg); 123 IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, reg);
160 124
161 /* Configure traffic class credits and priority */ 125 /* Configure traffic class credits and priority */
162 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 126 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
163 p = &dcb_config->tc_config[i].path[DCB_RX_CONFIG]; 127 credit_refill = refill[i];
164 128 credit_max = max[i];
165 credit_refill = p->data_credits_refill;
166 credit_max = p->data_credits_max;
167 reg = credit_refill | (credit_max << IXGBE_RTRPT4C_MCL_SHIFT); 129 reg = credit_refill | (credit_max << IXGBE_RTRPT4C_MCL_SHIFT);
168 130
169 reg |= (u32)(p->bwg_id) << IXGBE_RTRPT4C_BWG_SHIFT; 131 reg |= (u32)(bwg_id[i]) << IXGBE_RTRPT4C_BWG_SHIFT;
170 132
171 if (p->prio_type == prio_link) 133 if (prio_type[i] == prio_link)
172 reg |= IXGBE_RTRPT4C_LSP; 134 reg |= IXGBE_RTRPT4C_LSP;
173 135
174 IXGBE_WRITE_REG(hw, IXGBE_RTRPT4C(i), reg); 136 IXGBE_WRITE_REG(hw, IXGBE_RTRPT4C(i), reg);
@@ -187,14 +149,19 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
187/** 149/**
188 * ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter 150 * ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter
189 * @hw: pointer to hardware structure 151 * @hw: pointer to hardware structure
190 * @dcb_config: pointer to ixgbe_dcb_config structure 152 * @refill: refill credits index by traffic class
153 * @max: max credits index by traffic class
154 * @bwg_id: bandwidth grouping indexed by traffic class
155 * @prio_type: priority type indexed by traffic class
191 * 156 *
192 * Configure Tx Descriptor Arbiter and credits for each traffic class. 157 * Configure Tx Descriptor Arbiter and credits for each traffic class.
193 */ 158 */
194s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw, 159s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
195 struct ixgbe_dcb_config *dcb_config) 160 u16 *refill,
161 u16 *max,
162 u8 *bwg_id,
163 u8 *prio_type)
196{ 164{
197 struct tc_bw_alloc *p;
198 u32 reg, max_credits; 165 u32 reg, max_credits;
199 u8 i; 166 u8 i;
200 167
@@ -206,16 +173,15 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
206 173
207 /* Configure traffic class credits and priority */ 174 /* Configure traffic class credits and priority */
208 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 175 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
209 p = &dcb_config->tc_config[i].path[DCB_TX_CONFIG]; 176 max_credits = max[i];
210 max_credits = dcb_config->tc_config[i].desc_credits_max;
211 reg = max_credits << IXGBE_RTTDT2C_MCL_SHIFT; 177 reg = max_credits << IXGBE_RTTDT2C_MCL_SHIFT;
212 reg |= p->data_credits_refill; 178 reg |= refill[i];
213 reg |= (u32)(p->bwg_id) << IXGBE_RTTDT2C_BWG_SHIFT; 179 reg |= (u32)(bwg_id[i]) << IXGBE_RTTDT2C_BWG_SHIFT;
214 180
215 if (p->prio_type == prio_group) 181 if (prio_type[i] == prio_group)
216 reg |= IXGBE_RTTDT2C_GSP; 182 reg |= IXGBE_RTTDT2C_GSP;
217 183
218 if (p->prio_type == prio_link) 184 if (prio_type[i] == prio_link)
219 reg |= IXGBE_RTTDT2C_LSP; 185 reg |= IXGBE_RTTDT2C_LSP;
220 186
221 IXGBE_WRITE_REG(hw, IXGBE_RTTDT2C(i), reg); 187 IXGBE_WRITE_REG(hw, IXGBE_RTTDT2C(i), reg);
@@ -234,14 +200,20 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
234/** 200/**
235 * ixgbe_dcb_config_tx_data_arbiter_82599 - Config Tx Data arbiter 201 * ixgbe_dcb_config_tx_data_arbiter_82599 - Config Tx Data arbiter
236 * @hw: pointer to hardware structure 202 * @hw: pointer to hardware structure
237 * @dcb_config: pointer to ixgbe_dcb_config structure 203 * @refill: refill credits index by traffic class
204 * @max: max credits index by traffic class
205 * @bwg_id: bandwidth grouping indexed by traffic class
206 * @prio_type: priority type indexed by traffic class
238 * 207 *
239 * Configure Tx Packet Arbiter and credits for each traffic class. 208 * Configure Tx Packet Arbiter and credits for each traffic class.
240 */ 209 */
241s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw, 210s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
242 struct ixgbe_dcb_config *dcb_config) 211 u16 *refill,
212 u16 *max,
213 u8 *bwg_id,
214 u8 *prio_type,
215 u8 *prio_tc)
243{ 216{
244 struct tc_bw_alloc *p;
245 u32 reg; 217 u32 reg;
246 u8 i; 218 u8 i;
247 219
@@ -257,20 +229,19 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
257 /* Map all traffic classes to their UP, 1 to 1 */ 229 /* Map all traffic classes to their UP, 1 to 1 */
258 reg = 0; 230 reg = 0;
259 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) 231 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
260 reg |= (i << (i * IXGBE_RTTUP2TC_UP_SHIFT)); 232 reg |= (prio_tc[i] << (i * IXGBE_RTTUP2TC_UP_SHIFT));
261 IXGBE_WRITE_REG(hw, IXGBE_RTTUP2TC, reg); 233 IXGBE_WRITE_REG(hw, IXGBE_RTTUP2TC, reg);
262 234
263 /* Configure traffic class credits and priority */ 235 /* Configure traffic class credits and priority */
264 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 236 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
265 p = &dcb_config->tc_config[i].path[DCB_TX_CONFIG]; 237 reg = refill[i];
266 reg = p->data_credits_refill; 238 reg |= (u32)(max[i]) << IXGBE_RTTPT2C_MCL_SHIFT;
267 reg |= (u32)(p->data_credits_max) << IXGBE_RTTPT2C_MCL_SHIFT; 239 reg |= (u32)(bwg_id[i]) << IXGBE_RTTPT2C_BWG_SHIFT;
268 reg |= (u32)(p->bwg_id) << IXGBE_RTTPT2C_BWG_SHIFT;
269 240
270 if (p->prio_type == prio_group) 241 if (prio_type[i] == prio_group)
271 reg |= IXGBE_RTTPT2C_GSP; 242 reg |= IXGBE_RTTPT2C_GSP;
272 243
273 if (p->prio_type == prio_link) 244 if (prio_type[i] == prio_link)
274 reg |= IXGBE_RTTPT2C_LSP; 245 reg |= IXGBE_RTTPT2C_LSP;
275 246
276 IXGBE_WRITE_REG(hw, IXGBE_RTTPT2C(i), reg); 247 IXGBE_WRITE_REG(hw, IXGBE_RTTPT2C(i), reg);
@@ -290,65 +261,64 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
290/** 261/**
291 * ixgbe_dcb_config_pfc_82599 - Configure priority flow control 262 * ixgbe_dcb_config_pfc_82599 - Configure priority flow control
292 * @hw: pointer to hardware structure 263 * @hw: pointer to hardware structure
293 * @dcb_config: pointer to ixgbe_dcb_config structure 264 * @pfc_en: enabled pfc bitmask
294 * 265 *
295 * Configure Priority Flow Control (PFC) for each traffic class. 266 * Configure Priority Flow Control (PFC) for each traffic class.
296 */ 267 */
297s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, 268s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, u8 pfc_en)
298 struct ixgbe_dcb_config *dcb_config)
299{ 269{
300 u32 i, reg, rx_pba_size; 270 u32 i, reg, rx_pba_size;
301 271
302 /* If PFC is disabled globally then fall back to LFC. */
303 if (!dcb_config->pfc_mode_enable) {
304 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
305 hw->mac.ops.fc_enable(hw, i);
306 goto out;
307 }
308
309 /* Configure PFC Tx thresholds per TC */ 272 /* Configure PFC Tx thresholds per TC */
310 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 273 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
311 if (dcb_config->rx_pba_cfg == pba_equal) 274 int enabled = pfc_en & (1 << i);
312 rx_pba_size = IXGBE_RXPBSIZE_64KB; 275 rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i));
313 else 276 rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT;
314 rx_pba_size = (i < 4) ? IXGBE_RXPBSIZE_80KB
315 : IXGBE_RXPBSIZE_48KB;
316 277
317 reg = ((rx_pba_size >> 5) & 0xFFE0); 278 reg = (rx_pba_size - hw->fc.low_water) << 10;
318 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || 279
319 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx) 280 if (enabled)
320 reg |= IXGBE_FCRTL_XONE; 281 reg |= IXGBE_FCRTL_XONE;
321 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); 282 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg);
322 283
323 reg = ((rx_pba_size >> 2) & 0xFFE0); 284 reg = (rx_pba_size - hw->fc.high_water) << 10;
324 if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || 285 if (enabled)
325 dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx)
326 reg |= IXGBE_FCRTH_FCEN; 286 reg |= IXGBE_FCRTH_FCEN;
327 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); 287 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg);
328 } 288 }
329 289
330 /* Configure pause time (2 TCs per register) */ 290 if (pfc_en) {
331 reg = hw->fc.pause_time | (hw->fc.pause_time << 16); 291 /* Configure pause time (2 TCs per register) */
332 for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++) 292 reg = hw->fc.pause_time | (hw->fc.pause_time << 16);
333 IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg); 293 for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++)
294 IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);
334 295
335 /* Configure flow control refresh threshold value */ 296 /* Configure flow control refresh threshold value */
336 IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2); 297 IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2);
337 298
338 /* Enable Transmit PFC */
339 reg = IXGBE_FCCFG_TFCE_PRIORITY;
340 IXGBE_WRITE_REG(hw, IXGBE_FCCFG, reg);
341 299
342 /* 300 reg = IXGBE_FCCFG_TFCE_PRIORITY;
343 * Enable Receive PFC 301 IXGBE_WRITE_REG(hw, IXGBE_FCCFG, reg);
344 * We will always honor XOFF frames we receive when 302 /*
345 * we are in PFC mode. 303 * Enable Receive PFC
346 */ 304 * 82599 will always honor XOFF frames we receive when
347 reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); 305 * we are in PFC mode however X540 only honors enabled
348 reg &= ~IXGBE_MFLCN_RFCE; 306 * traffic classes.
349 reg |= IXGBE_MFLCN_RPFCE | IXGBE_MFLCN_DPF; 307 */
350 IXGBE_WRITE_REG(hw, IXGBE_MFLCN, reg); 308 reg = IXGBE_READ_REG(hw, IXGBE_MFLCN);
351out: 309 reg &= ~IXGBE_MFLCN_RFCE;
310 reg |= IXGBE_MFLCN_RPFCE | IXGBE_MFLCN_DPF;
311
312 if (hw->mac.type == ixgbe_mac_X540)
313 reg |= pfc_en << IXGBE_MFLCN_RPFCE_SHIFT;
314
315 IXGBE_WRITE_REG(hw, IXGBE_MFLCN, reg);
316
317 } else {
318 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
319 hw->mac.ops.fc_enable(hw, i);
320 }
321
352 return 0; 322 return 0;
353} 323}
354 324
@@ -359,7 +329,7 @@ out:
359 * Configure queue statistics registers, all queues belonging to same traffic 329 * Configure queue statistics registers, all queues belonging to same traffic
360 * class uses a single set of queue statistics counters. 330 * class uses a single set of queue statistics counters.
361 */ 331 */
362s32 ixgbe_dcb_config_tc_stats_82599(struct ixgbe_hw *hw) 332static s32 ixgbe_dcb_config_tc_stats_82599(struct ixgbe_hw *hw)
363{ 333{
364 u32 reg = 0; 334 u32 reg = 0;
365 u8 i = 0; 335 u8 i = 0;
@@ -408,11 +378,10 @@ s32 ixgbe_dcb_config_tc_stats_82599(struct ixgbe_hw *hw)
408/** 378/**
409 * ixgbe_dcb_config_82599 - Configure general DCB parameters 379 * ixgbe_dcb_config_82599 - Configure general DCB parameters
410 * @hw: pointer to hardware structure 380 * @hw: pointer to hardware structure
411 * @dcb_config: pointer to ixgbe_dcb_config structure
412 * 381 *
413 * Configure general DCB parameters. 382 * Configure general DCB parameters.
414 */ 383 */
415s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw) 384static s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw)
416{ 385{
417 u32 reg; 386 u32 reg;
418 u32 q; 387 u32 q;
@@ -454,25 +423,39 @@ s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw)
454 reg &= ~IXGBE_RTTDCS_ARBDIS; 423 reg &= ~IXGBE_RTTDCS_ARBDIS;
455 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg); 424 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg);
456 425
426 /* Enable Security TX Buffer IFG for DCB */
427 reg = IXGBE_READ_REG(hw, IXGBE_SECTXMINIFG);
428 reg |= IXGBE_SECTX_DCB;
429 IXGBE_WRITE_REG(hw, IXGBE_SECTXMINIFG, reg);
430
457 return 0; 431 return 0;
458} 432}
459 433
460/** 434/**
461 * ixgbe_dcb_hw_config_82599 - Configure and enable DCB 435 * ixgbe_dcb_hw_config_82599 - Configure and enable DCB
462 * @hw: pointer to hardware structure 436 * @hw: pointer to hardware structure
463 * @dcb_config: pointer to ixgbe_dcb_config structure 437 * @rx_pba: method to distribute packet buffer
438 * @refill: refill credits index by traffic class
439 * @max: max credits index by traffic class
440 * @bwg_id: bandwidth grouping indexed by traffic class
441 * @prio_type: priority type indexed by traffic class
442 * @pfc_en: enabled pfc bitmask
464 * 443 *
465 * Configure dcb settings and enable dcb mode. 444 * Configure dcb settings and enable dcb mode.
466 */ 445 */
467s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw, 446s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw,
468 struct ixgbe_dcb_config *dcb_config) 447 u8 rx_pba, u8 pfc_en, u16 *refill,
448 u16 *max, u8 *bwg_id, u8 *prio_type, u8 *prio_tc)
469{ 449{
470 ixgbe_dcb_config_packet_buffers_82599(hw, dcb_config); 450 ixgbe_dcb_config_packet_buffers_82599(hw, rx_pba);
471 ixgbe_dcb_config_82599(hw); 451 ixgbe_dcb_config_82599(hw);
472 ixgbe_dcb_config_rx_arbiter_82599(hw, dcb_config); 452 ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id,
473 ixgbe_dcb_config_tx_desc_arbiter_82599(hw, dcb_config); 453 prio_type, prio_tc);
474 ixgbe_dcb_config_tx_data_arbiter_82599(hw, dcb_config); 454 ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max,
475 ixgbe_dcb_config_pfc_82599(hw, dcb_config); 455 bwg_id, prio_type);
456 ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max,
457 bwg_id, prio_type, prio_tc);
458 ixgbe_dcb_config_pfc_82599(hw, pfc_en);
476 ixgbe_dcb_config_tc_stats_82599(hw); 459 ixgbe_dcb_config_tc_stats_82599(hw);
477 460
478 return 0; 461 return 0;