diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 164 |
1 files changed, 80 insertions, 84 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index dde65f951400..652e4b09546d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
@@ -44,62 +44,94 @@ | |||
44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ | 44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ |
45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ | 45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ |
46 | 46 | ||
47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, | 47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg, |
48 | struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) | 48 | struct ixgbe_dcb_config *dcfg, int tc_max) |
49 | { | 49 | { |
50 | struct tc_configuration *src_tc_cfg = NULL; | 50 | struct tc_configuration *src = NULL; |
51 | struct tc_configuration *dst_tc_cfg = NULL; | 51 | struct tc_configuration *dst = NULL; |
52 | int i; | 52 | int i, j; |
53 | int tx = DCB_TX_CONFIG; | ||
54 | int rx = DCB_RX_CONFIG; | ||
55 | int changes = 0; | ||
53 | 56 | ||
54 | if (!src_dcb_cfg || !dst_dcb_cfg) | 57 | if (!scfg || !dcfg) |
55 | return -EINVAL; | 58 | return changes; |
56 | 59 | ||
57 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { | 60 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { |
58 | src_tc_cfg = &src_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 61 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
59 | dst_tc_cfg = &dst_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 62 | dst = &dcfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
60 | 63 | ||
61 | dst_tc_cfg->path[DCB_TX_CONFIG].prio_type = | 64 | if (dst->path[tx].prio_type != src->path[tx].prio_type) { |
62 | src_tc_cfg->path[DCB_TX_CONFIG].prio_type; | 65 | dst->path[tx].prio_type = src->path[tx].prio_type; |
66 | changes |= BIT_PG_TX; | ||
67 | } | ||
63 | 68 | ||
64 | dst_tc_cfg->path[DCB_TX_CONFIG].bwg_id = | 69 | if (dst->path[tx].bwg_id != src->path[tx].bwg_id) { |
65 | src_tc_cfg->path[DCB_TX_CONFIG].bwg_id; | 70 | dst->path[tx].bwg_id = src->path[tx].bwg_id; |
71 | changes |= BIT_PG_TX; | ||
72 | } | ||
66 | 73 | ||
67 | dst_tc_cfg->path[DCB_TX_CONFIG].bwg_percent = | 74 | if (dst->path[tx].bwg_percent != src->path[tx].bwg_percent) { |
68 | src_tc_cfg->path[DCB_TX_CONFIG].bwg_percent; | 75 | dst->path[tx].bwg_percent = src->path[tx].bwg_percent; |
76 | changes |= BIT_PG_TX; | ||
77 | } | ||
69 | 78 | ||
70 | dst_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap = | 79 | if (dst->path[tx].up_to_tc_bitmap != |
71 | src_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap; | 80 | src->path[tx].up_to_tc_bitmap) { |
81 | dst->path[tx].up_to_tc_bitmap = | ||
82 | src->path[tx].up_to_tc_bitmap; | ||
83 | changes |= (BIT_PG_TX | BIT_PFC | BIT_APP_UPCHG); | ||
84 | } | ||
72 | 85 | ||
73 | dst_tc_cfg->path[DCB_RX_CONFIG].prio_type = | 86 | if (dst->path[rx].prio_type != src->path[rx].prio_type) { |
74 | src_tc_cfg->path[DCB_RX_CONFIG].prio_type; | 87 | dst->path[rx].prio_type = src->path[rx].prio_type; |
88 | changes |= BIT_PG_RX; | ||
89 | } | ||
75 | 90 | ||
76 | dst_tc_cfg->path[DCB_RX_CONFIG].bwg_id = | 91 | if (dst->path[rx].bwg_id != src->path[rx].bwg_id) { |
77 | src_tc_cfg->path[DCB_RX_CONFIG].bwg_id; | 92 | dst->path[rx].bwg_id = src->path[rx].bwg_id; |
93 | changes |= BIT_PG_RX; | ||
94 | } | ||
78 | 95 | ||
79 | dst_tc_cfg->path[DCB_RX_CONFIG].bwg_percent = | 96 | if (dst->path[rx].bwg_percent != src->path[rx].bwg_percent) { |
80 | src_tc_cfg->path[DCB_RX_CONFIG].bwg_percent; | 97 | dst->path[rx].bwg_percent = src->path[rx].bwg_percent; |
98 | changes |= BIT_PG_RX; | ||
99 | } | ||
81 | 100 | ||
82 | dst_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap = | 101 | if (dst->path[rx].up_to_tc_bitmap != |
83 | src_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap; | 102 | src->path[rx].up_to_tc_bitmap) { |
103 | dst->path[rx].up_to_tc_bitmap = | ||
104 | src->path[rx].up_to_tc_bitmap; | ||
105 | changes |= (BIT_PG_RX | BIT_PFC | BIT_APP_UPCHG); | ||
106 | } | ||
84 | } | 107 | } |
85 | 108 | ||
86 | for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { | 109 | for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { |
87 | dst_dcb_cfg->bw_percentage[DCB_TX_CONFIG] | 110 | j = i - DCB_PG_ATTR_BW_ID_0; |
88 | [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage | 111 | if (dcfg->bw_percentage[tx][j] != scfg->bw_percentage[tx][j]) { |
89 | [DCB_TX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; | 112 | dcfg->bw_percentage[tx][j] = scfg->bw_percentage[tx][j]; |
90 | dst_dcb_cfg->bw_percentage[DCB_RX_CONFIG] | 113 | changes |= BIT_PG_TX; |
91 | [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage | 114 | } |
92 | [DCB_RX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; | 115 | if (dcfg->bw_percentage[rx][j] != scfg->bw_percentage[rx][j]) { |
116 | dcfg->bw_percentage[rx][j] = scfg->bw_percentage[rx][j]; | ||
117 | changes |= BIT_PG_RX; | ||
118 | } | ||
93 | } | 119 | } |
94 | 120 | ||
95 | for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { | 121 | for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { |
96 | dst_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc = | 122 | j = i - DCB_PFC_UP_ATTR_0; |
97 | src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc; | 123 | if (dcfg->tc_config[j].dcb_pfc != scfg->tc_config[j].dcb_pfc) { |
124 | dcfg->tc_config[j].dcb_pfc = scfg->tc_config[j].dcb_pfc; | ||
125 | changes |= BIT_PFC; | ||
126 | } | ||
98 | } | 127 | } |
99 | 128 | ||
100 | dst_dcb_cfg->pfc_mode_enable = src_dcb_cfg->pfc_mode_enable; | 129 | if (dcfg->pfc_mode_enable != scfg->pfc_mode_enable) { |
130 | dcfg->pfc_mode_enable = scfg->pfc_mode_enable; | ||
131 | changes |= BIT_PFC; | ||
132 | } | ||
101 | 133 | ||
102 | return 0; | 134 | return changes; |
103 | } | 135 | } |
104 | 136 | ||
105 | static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) | 137 | static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) |
@@ -179,20 +211,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, | |||
179 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) | 211 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
180 | adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = | 212 | adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = |
181 | up_map; | 213 | up_map; |
182 | |||
183 | if ((adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type != | ||
184 | adapter->dcb_cfg.tc_config[tc].path[0].prio_type) || | ||
185 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_id != | ||
186 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_id) || | ||
187 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent != | ||
188 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) || | ||
189 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | ||
190 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) | ||
191 | adapter->dcb_set_bitmap |= BIT_PG_TX; | ||
192 | |||
193 | if (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | ||
194 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap) | ||
195 | adapter->dcb_set_bitmap |= BIT_PFC | BIT_APP_UPCHG; | ||
196 | } | 214 | } |
197 | 215 | ||
198 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | 216 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, |
@@ -201,10 +219,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | |||
201 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 219 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
202 | 220 | ||
203 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; | 221 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; |
204 | |||
205 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != | ||
206 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) | ||
207 | adapter->dcb_set_bitmap |= BIT_PG_TX; | ||
208 | } | 222 | } |
209 | 223 | ||
210 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | 224 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, |
@@ -223,20 +237,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | |||
223 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) | 237 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
224 | adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = | 238 | adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = |
225 | up_map; | 239 | up_map; |
226 | |||
227 | if ((adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type != | ||
228 | adapter->dcb_cfg.tc_config[tc].path[1].prio_type) || | ||
229 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_id != | ||
230 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_id) || | ||
231 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent != | ||
232 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) || | ||
233 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | ||
234 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) | ||
235 | adapter->dcb_set_bitmap |= BIT_PG_RX; | ||
236 | |||
237 | if (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | ||
238 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap) | ||
239 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
240 | } | 240 | } |
241 | 241 | ||
242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | 242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, |
@@ -245,10 +245,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | |||
245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
246 | 246 | ||
247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; | 247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; |
248 | |||
249 | if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] != | ||
250 | adapter->dcb_cfg.bw_percentage[1][bwg_id]) | ||
251 | adapter->dcb_set_bitmap |= BIT_PG_RX; | ||
252 | } | 248 | } |
253 | 249 | ||
254 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, | 250 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, |
@@ -298,10 +294,8 @@ static void ixgbe_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | |||
298 | 294 | ||
299 | adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; | 295 | adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; |
300 | if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != | 296 | if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != |
301 | adapter->dcb_cfg.tc_config[priority].dcb_pfc) { | 297 | adapter->dcb_cfg.tc_config[priority].dcb_pfc) |
302 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
303 | adapter->temp_dcb_cfg.pfc_mode_enable = true; | 298 | adapter->temp_dcb_cfg.pfc_mode_enable = true; |
304 | } | ||
305 | } | 299 | } |
306 | 300 | ||
307 | static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | 301 | static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
@@ -336,7 +330,8 @@ static void ixgbe_dcbnl_devreset(struct net_device *dev) | |||
336 | static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | 330 | static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) |
337 | { | 331 | { |
338 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 332 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
339 | int ret, i; | 333 | int ret = DCB_NO_HW_CHG; |
334 | int i; | ||
340 | #ifdef IXGBE_FCOE | 335 | #ifdef IXGBE_FCOE |
341 | struct dcb_app app = { | 336 | struct dcb_app app = { |
342 | .selector = DCB_APP_IDTYPE_ETHTYPE, | 337 | .selector = DCB_APP_IDTYPE_ETHTYPE, |
@@ -355,12 +350,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
355 | 350 | ||
356 | /* Fail command if not in CEE mode */ | 351 | /* Fail command if not in CEE mode */ |
357 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 352 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
358 | return 1; | 353 | return ret; |
359 | 354 | ||
360 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | 355 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, |
361 | MAX_TRAFFIC_CLASS); | 356 | &adapter->dcb_cfg, |
362 | if (ret) | 357 | MAX_TRAFFIC_CLASS); |
363 | return DCB_NO_HW_CHG; | 358 | if (!adapter->dcb_set_bitmap) |
359 | return ret; | ||
364 | 360 | ||
365 | if (adapter->dcb_cfg.pfc_mode_enable) { | 361 | if (adapter->dcb_cfg.pfc_mode_enable) { |
366 | switch (adapter->hw.mac.type) { | 362 | switch (adapter->hw.mac.type) { |
@@ -420,6 +416,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
420 | 416 | ||
421 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | 417 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) |
422 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); | 418 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); |
419 | |||
420 | ret = DCB_HW_CHG_RST; | ||
423 | } | 421 | } |
424 | 422 | ||
425 | if (adapter->dcb_set_bitmap & BIT_PFC) { | 423 | if (adapter->dcb_set_bitmap & BIT_PFC) { |
@@ -430,7 +428,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
430 | DCB_TX_CONFIG, prio_tc); | 428 | DCB_TX_CONFIG, prio_tc); |
431 | ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); | 429 | ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); |
432 | ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); | 430 | ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); |
433 | ret = DCB_HW_CHG; | 431 | if (ret != DCB_HW_CHG_RST) |
432 | ret = DCB_HW_CHG; | ||
434 | } | 433 | } |
435 | 434 | ||
436 | if (adapter->dcb_cfg.pfc_mode_enable) | 435 | if (adapter->dcb_cfg.pfc_mode_enable) |
@@ -531,9 +530,6 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state) | |||
531 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 530 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
532 | 531 | ||
533 | adapter->temp_dcb_cfg.pfc_mode_enable = state; | 532 | adapter->temp_dcb_cfg.pfc_mode_enable = state; |
534 | if (adapter->temp_dcb_cfg.pfc_mode_enable != | ||
535 | adapter->dcb_cfg.pfc_mode_enable) | ||
536 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
537 | } | 533 | } |
538 | 534 | ||
539 | /** | 535 | /** |