aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_dcb.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2011-01-04 23:47:43 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-02-11 11:44:04 -0500
commit55320cb58baebd1795ec92f4550a1e8b38bf9ddf (patch)
treeb2cf72c8c649e71677ba14ecd02bb7e27976d570 /drivers/net/ixgbe/ixgbe_dcb.c
parent39a7e587ec76db9f157fce653235b20f5283b003 (diff)
ixgbe: DCB, abstract out dcb_config from DCB hardware configuration
Currently the routines that configure the HW for DCB require a ixgbe_dcb_config structure. This structure was designed to support the CEE standard and does not match the IEEE standard well. This patch changes the HW routines in ixgbe_dcb_8259x.{ch} to use raw pfc and bandwidth values. This requires some parsing of the DCB configuration but makes the HW routines independent of the data structure that contains the DCB configuration. The primary advantage to doing this is we can do HW setup directly from the 802.1Qaz ops without having to arbitrarily encapsulate this data into the CEE structure. 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/net/ixgbe/ixgbe_dcb.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb.c74
1 files changed, 72 insertions, 2 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb.c b/drivers/net/ixgbe/ixgbe_dcb.c
index d16c260c1f50..d9bb670ae258 100644
--- a/drivers/net/ixgbe/ixgbe_dcb.c
+++ b/drivers/net/ixgbe/ixgbe_dcb.c
@@ -141,6 +141,59 @@ out:
141 return ret_val; 141 return ret_val;
142} 142}
143 143
144void ixgbe_dcb_unpack_pfc(struct ixgbe_dcb_config *cfg, u8 *pfc_en)
145{
146 int i;
147
148 *pfc_en = 0;
149 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
150 *pfc_en |= (cfg->tc_config[i].dcb_pfc & 0xF) << i;
151}
152
153void ixgbe_dcb_unpack_refill(struct ixgbe_dcb_config *cfg, int direction,
154 u16 *refill)
155{
156 struct tc_bw_alloc *p;
157 int i;
158
159 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
160 p = &cfg->tc_config[i].path[direction];
161 refill[i] = p->data_credits_refill;
162 }
163}
164
165void ixgbe_dcb_unpack_max(struct ixgbe_dcb_config *cfg, u16 *max)
166{
167 int i;
168
169 for (i = 0; i < MAX_TRAFFIC_CLASS; i++)
170 max[i] = cfg->tc_config[i].desc_credits_max;
171}
172
173void ixgbe_dcb_unpack_bwgid(struct ixgbe_dcb_config *cfg, int direction,
174 u8 *bwgid)
175{
176 struct tc_bw_alloc *p;
177 int i;
178
179 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
180 p = &cfg->tc_config[i].path[direction];
181 bwgid[i] = p->bwg_id;
182 }
183}
184
185void ixgbe_dcb_unpack_prio(struct ixgbe_dcb_config *cfg, int direction,
186 u8 *ptype)
187{
188 struct tc_bw_alloc *p;
189 int i;
190
191 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
192 p = &cfg->tc_config[i].path[direction];
193 ptype[i] = p->prio_type;
194 }
195}
196
144/** 197/**
145 * ixgbe_dcb_hw_config - Config and enable DCB 198 * ixgbe_dcb_hw_config - Config and enable DCB
146 * @hw: pointer to hardware structure 199 * @hw: pointer to hardware structure
@@ -152,13 +205,30 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw,
152 struct ixgbe_dcb_config *dcb_config) 205 struct ixgbe_dcb_config *dcb_config)
153{ 206{
154 s32 ret = 0; 207 s32 ret = 0;
208 u8 pfc_en;
209 u8 ptype[MAX_TRAFFIC_CLASS];
210 u8 bwgid[MAX_TRAFFIC_CLASS];
211 u16 refill[MAX_TRAFFIC_CLASS];
212 u16 max[MAX_TRAFFIC_CLASS];
213
214 /* Unpack CEE standard containers */
215 ixgbe_dcb_unpack_pfc(dcb_config, &pfc_en);
216 ixgbe_dcb_unpack_refill(dcb_config, DCB_TX_CONFIG, refill);
217 ixgbe_dcb_unpack_max(dcb_config, max);
218 ixgbe_dcb_unpack_bwgid(dcb_config, DCB_TX_CONFIG, bwgid);
219 ixgbe_dcb_unpack_prio(dcb_config, DCB_TX_CONFIG, ptype);
220
155 switch (hw->mac.type) { 221 switch (hw->mac.type) {
156 case ixgbe_mac_82598EB: 222 case ixgbe_mac_82598EB:
157 ret = ixgbe_dcb_hw_config_82598(hw, dcb_config); 223 ret = ixgbe_dcb_hw_config_82598(hw, dcb_config->rx_pba_cfg,
224 pfc_en, refill, max, bwgid,
225 ptype);
158 break; 226 break;
159 case ixgbe_mac_82599EB: 227 case ixgbe_mac_82599EB:
160 case ixgbe_mac_X540: 228 case ixgbe_mac_X540:
161 ret = ixgbe_dcb_hw_config_82599(hw, dcb_config); 229 ret = ixgbe_dcb_hw_config_82599(hw, dcb_config->rx_pba_cfg,
230 pfc_en, refill, max, bwgid,
231 ptype);
162 break; 232 break;
163 default: 233 default:
164 break; 234 break;