aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2011-02-23 00:58:19 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-03-12 07:12:54 -0500
commit17049d30c2dec6f26d6165cc135578f9e41d53d3 (patch)
treeb58a6c005d89c15a58213cc2e62e9d4de81d8c37 /drivers
parent3b97fd695453ced96f22bdf1a84453f6744d25cc (diff)
ixgbe: IEEE 802.1Qaz, implement priority assignment table
This patch adds support to use the priority assignment table in the ieee_ets structure to map priorities to traffic classes. Previously ixgbe only supported a 1:1 mapping. Now we can enable and disable hardware DCB support when multiple traffic classes are actually being used. This allows the default case all priorities mapped to traffic class 0 to work in normal hardware mode and utilize the full packet buffer. This patch does not address putting the hardware in 4TC mode so packet buffer space may be underutilized in this case. A follow up patch can address this optimization. But at least we have the hooks to do this now. Also CEE will behave as it always has and map priorities 1:1 with traffic classes. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb.c13
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb.h4
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_82599.c17
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_82599.h9
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c12
5 files changed, 36 insertions, 19 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb.c b/drivers/net/ixgbe/ixgbe_dcb.c
index e2e7a292525d..e7b551af573d 100644
--- a/drivers/net/ixgbe/ixgbe_dcb.c
+++ b/drivers/net/ixgbe/ixgbe_dcb.c
@@ -246,6 +246,8 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw,
246 u8 bwgid[MAX_TRAFFIC_CLASS]; 246 u8 bwgid[MAX_TRAFFIC_CLASS];
247 u16 refill[MAX_TRAFFIC_CLASS]; 247 u16 refill[MAX_TRAFFIC_CLASS];
248 u16 max[MAX_TRAFFIC_CLASS]; 248 u16 max[MAX_TRAFFIC_CLASS];
249 /* CEE does not define a priority to tc mapping so map 1:1 */
250 u8 prio_tc[MAX_TRAFFIC_CLASS] = {0, 1, 2, 3, 4, 5, 6, 7};
249 251
250 /* Unpack CEE standard containers */ 252 /* Unpack CEE standard containers */
251 ixgbe_dcb_unpack_pfc(dcb_config, &pfc_en); 253 ixgbe_dcb_unpack_pfc(dcb_config, &pfc_en);
@@ -264,7 +266,7 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw,
264 case ixgbe_mac_X540: 266 case ixgbe_mac_X540:
265 ret = ixgbe_dcb_hw_config_82599(hw, dcb_config->rx_pba_cfg, 267 ret = ixgbe_dcb_hw_config_82599(hw, dcb_config->rx_pba_cfg,
266 pfc_en, refill, max, bwgid, 268 pfc_en, refill, max, bwgid,
267 ptype); 269 ptype, prio_tc);
268 break; 270 break;
269 default: 271 default:
270 break; 272 break;
@@ -292,7 +294,8 @@ s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en)
292} 294}
293 295
294s32 ixgbe_dcb_hw_ets_config(struct ixgbe_hw *hw, 296s32 ixgbe_dcb_hw_ets_config(struct ixgbe_hw *hw,
295 u16 *refill, u16 *max, u8 *bwg_id, u8 *prio_type) 297 u16 *refill, u16 *max, u8 *bwg_id,
298 u8 *prio_type, u8 *prio_tc)
296{ 299{
297 switch (hw->mac.type) { 300 switch (hw->mac.type) {
298 case ixgbe_mac_82598EB: 301 case ixgbe_mac_82598EB:
@@ -306,11 +309,11 @@ s32 ixgbe_dcb_hw_ets_config(struct ixgbe_hw *hw,
306 case ixgbe_mac_82599EB: 309 case ixgbe_mac_82599EB:
307 case ixgbe_mac_X540: 310 case ixgbe_mac_X540:
308 ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, 311 ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max,
309 bwg_id, prio_type); 312 bwg_id, prio_type, prio_tc);
310 ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max, 313 ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max,
311 bwg_id, prio_type); 314 bwg_id, prio_type);
312 ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, 315 ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, bwg_id,
313 bwg_id, prio_type); 316 prio_type, prio_tc);
314 break; 317 break;
315 default: 318 default:
316 break; 319 break;
diff --git a/drivers/net/ixgbe/ixgbe_dcb.h b/drivers/net/ixgbe/ixgbe_dcb.h
index 515bc27477f6..944838fc7b59 100644
--- a/drivers/net/ixgbe/ixgbe_dcb.h
+++ b/drivers/net/ixgbe/ixgbe_dcb.h
@@ -159,8 +159,8 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *,
159 struct ixgbe_dcb_config *, int, u8); 159 struct ixgbe_dcb_config *, int, u8);
160 160
161/* DCB hw initialization */ 161/* DCB hw initialization */
162s32 ixgbe_dcb_hw_ets_config(struct ixgbe_hw *hw, 162s32 ixgbe_dcb_hw_ets_config(struct ixgbe_hw *hw, u16 *refill, u16 *max,
163 u16 *refill, u16 *max, u8 *bwg_id, u8 *prio_type); 163 u8 *bwg_id, u8 *prio_type, u8 *tc_prio);
164s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en); 164s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en);
165s32 ixgbe_dcb_hw_config(struct ixgbe_hw *, struct ixgbe_dcb_config *); 165s32 ixgbe_dcb_hw_config(struct ixgbe_hw *, struct ixgbe_dcb_config *);
166 166
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c
index beaa1c1c1e67..0a482bbf1bd2 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_82599.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c
@@ -85,7 +85,8 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
85 u16 *refill, 85 u16 *refill,
86 u16 *max, 86 u16 *max,
87 u8 *bwg_id, 87 u8 *bwg_id,
88 u8 *prio_type) 88 u8 *prio_type,
89 u8 *prio_tc)
89{ 90{
90 u32 reg = 0; 91 u32 reg = 0;
91 u32 credit_refill = 0; 92 u32 credit_refill = 0;
@@ -102,7 +103,7 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
102 /* Map all traffic classes to their UP, 1 to 1 */ 103 /* Map all traffic classes to their UP, 1 to 1 */
103 reg = 0; 104 reg = 0;
104 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) 105 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
105 reg |= (i << (i * IXGBE_RTRUP2TC_UP_SHIFT)); 106 reg |= (prio_tc[i] << (i * IXGBE_RTRUP2TC_UP_SHIFT));
106 IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, reg); 107 IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, reg);
107 108
108 /* Configure traffic class credits and priority */ 109 /* Configure traffic class credits and priority */
@@ -194,7 +195,8 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
194 u16 *refill, 195 u16 *refill,
195 u16 *max, 196 u16 *max,
196 u8 *bwg_id, 197 u8 *bwg_id,
197 u8 *prio_type) 198 u8 *prio_type,
199 u8 *prio_tc)
198{ 200{
199 u32 reg; 201 u32 reg;
200 u8 i; 202 u8 i;
@@ -211,7 +213,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
211 /* Map all traffic classes to their UP, 1 to 1 */ 213 /* Map all traffic classes to their UP, 1 to 1 */
212 reg = 0; 214 reg = 0;
213 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) 215 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
214 reg |= (i << (i * IXGBE_RTTUP2TC_UP_SHIFT)); 216 reg |= (prio_tc[i] << (i * IXGBE_RTTUP2TC_UP_SHIFT));
215 IXGBE_WRITE_REG(hw, IXGBE_RTTUP2TC, reg); 217 IXGBE_WRITE_REG(hw, IXGBE_RTTUP2TC, reg);
216 218
217 /* Configure traffic class credits and priority */ 219 /* Configure traffic class credits and priority */
@@ -424,15 +426,16 @@ static s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw)
424 */ 426 */
425s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw, 427s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw,
426 u8 rx_pba, u8 pfc_en, u16 *refill, 428 u8 rx_pba, u8 pfc_en, u16 *refill,
427 u16 *max, u8 *bwg_id, u8 *prio_type) 429 u16 *max, u8 *bwg_id, u8 *prio_type, u8 *prio_tc)
428{ 430{
429 ixgbe_dcb_config_packet_buffers_82599(hw, rx_pba); 431 ixgbe_dcb_config_packet_buffers_82599(hw, rx_pba);
430 ixgbe_dcb_config_82599(hw); 432 ixgbe_dcb_config_82599(hw);
431 ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id, prio_type); 433 ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id,
434 prio_type, prio_tc);
432 ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max, 435 ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max,
433 bwg_id, prio_type); 436 bwg_id, prio_type);
434 ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, 437 ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max,
435 bwg_id, prio_type); 438 bwg_id, prio_type, prio_tc);
436 ixgbe_dcb_config_pfc_82599(hw, pfc_en); 439 ixgbe_dcb_config_pfc_82599(hw, pfc_en);
437 ixgbe_dcb_config_tc_stats_82599(hw); 440 ixgbe_dcb_config_tc_stats_82599(hw);
438 441
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.h b/drivers/net/ixgbe/ixgbe_dcb_82599.h
index 0b39ab4ffc70..148fd8b477a9 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_82599.h
+++ b/drivers/net/ixgbe/ixgbe_dcb_82599.h
@@ -109,7 +109,8 @@ s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw,
109 u16 *refill, 109 u16 *refill,
110 u16 *max, 110 u16 *max,
111 u8 *bwg_id, 111 u8 *bwg_id,
112 u8 *prio_type); 112 u8 *prio_type,
113 u8 *prio_tc);
113 114
114s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw, 115s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw,
115 u16 *refill, 116 u16 *refill,
@@ -121,10 +122,12 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw,
121 u16 *refill, 122 u16 *refill,
122 u16 *max, 123 u16 *max,
123 u8 *bwg_id, 124 u8 *bwg_id,
124 u8 *prio_type); 125 u8 *prio_type,
126 u8 *prio_tc);
125 127
126s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw, 128s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw,
127 u8 rx_pba, u8 pfc_en, u16 *refill, 129 u8 rx_pba, u8 pfc_en, u16 *refill,
128 u16 *max, u8 *bwg_id, u8 *prio_type); 130 u16 *max, u8 *bwg_id, u8 *prio_type,
131 u8 *prio_tc);
129 132
130#endif /* _DCB_82599_CONFIG_H */ 133#endif /* _DCB_82599_CONFIG_H */
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index 8abef8d588fd..fec4c724c37a 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -416,6 +416,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
416 if (adapter->dcb_set_bitmap & (BIT_PG_TX|BIT_PG_RX)) { 416 if (adapter->dcb_set_bitmap & (BIT_PG_TX|BIT_PG_RX)) {
417 u16 refill[MAX_TRAFFIC_CLASS], max[MAX_TRAFFIC_CLASS]; 417 u16 refill[MAX_TRAFFIC_CLASS], max[MAX_TRAFFIC_CLASS];
418 u8 bwg_id[MAX_TRAFFIC_CLASS], prio_type[MAX_TRAFFIC_CLASS]; 418 u8 bwg_id[MAX_TRAFFIC_CLASS], prio_type[MAX_TRAFFIC_CLASS];
419 /* Priority to TC mapping in CEE case default to 1:1 */
420 u8 prio_tc[MAX_TRAFFIC_CLASS] = {0, 1, 2, 3, 4, 5, 6, 7};
419 int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 421 int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
420 422
421#ifdef CONFIG_FCOE 423#ifdef CONFIG_FCOE
@@ -437,7 +439,7 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
437 DCB_TX_CONFIG, prio_type); 439 DCB_TX_CONFIG, prio_type);
438 440
439 ixgbe_dcb_hw_ets_config(&adapter->hw, refill, max, 441 ixgbe_dcb_hw_ets_config(&adapter->hw, refill, max,
440 bwg_id, prio_type); 442 bwg_id, prio_type, prio_tc);
441 } 443 }
442 444
443 if (adapter->dcb_cfg.pfc_mode_enable) 445 if (adapter->dcb_cfg.pfc_mode_enable)
@@ -645,6 +647,7 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev,
645 __u8 prio_type[IEEE_8021QAZ_MAX_TCS]; 647 __u8 prio_type[IEEE_8021QAZ_MAX_TCS];
646 int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN; 648 int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN;
647 int i, err; 649 int i, err;
650 __u64 *p = (__u64 *) ets->prio_tc;
648 /* naively give each TC a bwg to map onto CEE hardware */ 651 /* naively give each TC a bwg to map onto CEE hardware */
649 __u8 bwg_id[IEEE_8021QAZ_MAX_TCS] = {0, 1, 2, 3, 4, 5, 6, 7}; 652 __u8 bwg_id[IEEE_8021QAZ_MAX_TCS] = {0, 1, 2, 3, 4, 5, 6, 7};
650 653
@@ -679,9 +682,14 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev,
679 } 682 }
680 } 683 }
681 684
685 if (*p)
686 ixgbe_dcbnl_set_state(dev, 1);
687 else
688 ixgbe_dcbnl_set_state(dev, 0);
689
682 ixgbe_ieee_credits(ets->tc_tx_bw, refill, max, max_frame); 690 ixgbe_ieee_credits(ets->tc_tx_bw, refill, max, max_frame);
683 err = ixgbe_dcb_hw_ets_config(&adapter->hw, refill, max, 691 err = ixgbe_dcb_hw_ets_config(&adapter->hw, refill, max,
684 bwg_id, prio_type); 692 bwg_id, prio_type, ets->prio_tc);
685 return err; 693 return err;
686} 694}
687 695