diff options
author | Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> | 2009-05-17 08:35:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-18 00:04:14 -0400 |
commit | 62551d3ea05242d97d47f26fb517b2dfdb752310 (patch) | |
tree | 704a68bff5c26881bfff502d5dd0f2af610b1e46 /drivers/net/ixgbe | |
parent | 8756924c1ecc832c1a5603d10f5cd201e299b312 (diff) |
ixgbe: Don't reset the hardware when switching between LFC and PFC
When running in DCB mode, switching between link flow control and priority
flow control shouldn't need to reset the hardware. This removes that
reset.
This also extends the set_all() dcbnl callback to return a value indicating
that the HW config changed, however a reset was not required.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb_nl.c | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 6cbff96cc0ff..d56890f5c9d5 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -28,15 +28,22 @@ | |||
28 | 28 | ||
29 | #include "ixgbe.h" | 29 | #include "ixgbe.h" |
30 | #include <linux/dcbnl.h> | 30 | #include <linux/dcbnl.h> |
31 | #include "ixgbe_dcb_82598.h" | ||
32 | #include "ixgbe_dcb_82599.h" | ||
31 | 33 | ||
32 | /* Callbacks for DCB netlink in the kernel */ | 34 | /* Callbacks for DCB netlink in the kernel */ |
33 | #define BIT_DCB_MODE 0x01 | 35 | #define BIT_DCB_MODE 0x01 |
34 | #define BIT_PFC 0x02 | 36 | #define BIT_PFC 0x02 |
35 | #define BIT_PG_RX 0x04 | 37 | #define BIT_PG_RX 0x04 |
36 | #define BIT_PG_TX 0x08 | 38 | #define BIT_PG_TX 0x08 |
37 | #define BIT_BCN 0x10 | 39 | #define BIT_RESETLINK 0x40 |
38 | #define BIT_LINKSPEED 0x80 | 40 | #define BIT_LINKSPEED 0x80 |
39 | 41 | ||
42 | /* Responses for the DCB_C_SET_ALL command */ | ||
43 | #define DCB_HW_CHG_RST 0 /* DCB configuration changed with reset */ | ||
44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ | ||
45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ | ||
46 | |||
40 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, | 47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, |
41 | struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) | 48 | struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) |
42 | { | 49 | { |
@@ -195,8 +202,10 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, | |||
195 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent != | 202 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent != |
196 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) || | 203 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) || |
197 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | 204 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != |
198 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) | 205 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) { |
199 | adapter->dcb_set_bitmap |= BIT_PG_TX; | 206 | adapter->dcb_set_bitmap |= BIT_PG_TX; |
207 | adapter->dcb_set_bitmap |= BIT_RESETLINK; | ||
208 | } | ||
200 | } | 209 | } |
201 | 210 | ||
202 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | 211 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, |
@@ -207,8 +216,10 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | |||
207 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; | 216 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; |
208 | 217 | ||
209 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != | 218 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != |
210 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) | 219 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) { |
211 | adapter->dcb_set_bitmap |= BIT_PG_RX; | 220 | adapter->dcb_set_bitmap |= BIT_PG_RX; |
221 | adapter->dcb_set_bitmap |= BIT_RESETLINK; | ||
222 | } | ||
212 | } | 223 | } |
213 | 224 | ||
214 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | 225 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, |
@@ -235,8 +246,10 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | |||
235 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent != | 246 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent != |
236 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) || | 247 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) || |
237 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | 248 | (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)) | 249 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) { |
239 | adapter->dcb_set_bitmap |= BIT_PG_RX; | 250 | adapter->dcb_set_bitmap |= BIT_PG_RX; |
251 | adapter->dcb_set_bitmap |= BIT_RESETLINK; | ||
252 | } | ||
240 | } | 253 | } |
241 | 254 | ||
242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | 255 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, |
@@ -247,8 +260,10 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | |||
247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; | 260 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; |
248 | 261 | ||
249 | if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] != | 262 | if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] != |
250 | adapter->dcb_cfg.bw_percentage[1][bwg_id]) | 263 | adapter->dcb_cfg.bw_percentage[1][bwg_id]) { |
251 | adapter->dcb_set_bitmap |= BIT_PG_RX; | 264 | adapter->dcb_set_bitmap |= BIT_PG_RX; |
265 | adapter->dcb_set_bitmap |= BIT_RESETLINK; | ||
266 | } | ||
252 | } | 267 | } |
253 | 268 | ||
254 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, | 269 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, |
@@ -317,21 +332,27 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
317 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 332 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
318 | int ret; | 333 | int ret; |
319 | 334 | ||
320 | adapter->dcb_set_bitmap &= ~BIT_BCN; /* no set for BCN */ | ||
321 | if (!adapter->dcb_set_bitmap) | 335 | if (!adapter->dcb_set_bitmap) |
322 | return 1; | 336 | return DCB_NO_HW_CHG; |
323 | 337 | ||
324 | while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) | 338 | /* |
325 | msleep(1); | 339 | * Only take down the adapter if the configuration change |
340 | * requires a reset. | ||
341 | */ | ||
342 | if (adapter->dcb_set_bitmap & BIT_RESETLINK) { | ||
343 | while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) | ||
344 | msleep(1); | ||
326 | 345 | ||
327 | if (netif_running(netdev)) | 346 | if (netif_running(netdev)) |
328 | ixgbe_down(adapter); | 347 | ixgbe_down(adapter); |
348 | } | ||
329 | 349 | ||
330 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | 350 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, |
331 | adapter->ring_feature[RING_F_DCB].indices); | 351 | adapter->ring_feature[RING_F_DCB].indices); |
332 | if (ret) { | 352 | if (ret) { |
333 | clear_bit(__IXGBE_RESETTING, &adapter->state); | 353 | if (adapter->dcb_set_bitmap & BIT_RESETLINK) |
334 | return ret; | 354 | clear_bit(__IXGBE_RESETTING, &adapter->state); |
355 | return DCB_NO_HW_CHG; | ||
335 | } | 356 | } |
336 | 357 | ||
337 | if (adapter->dcb_cfg.pfc_mode_enable) { | 358 | if (adapter->dcb_cfg.pfc_mode_enable) { |
@@ -346,14 +367,25 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
346 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | 367 | adapter->hw.fc.requested_mode = ixgbe_fc_none; |
347 | } | 368 | } |
348 | 369 | ||
349 | if (netif_running(netdev)) | 370 | if (adapter->dcb_set_bitmap & BIT_RESETLINK) { |
350 | ixgbe_up(adapter); | 371 | if (netif_running(netdev)) |
351 | 372 | ixgbe_up(adapter); | |
373 | ret = DCB_HW_CHG_RST; | ||
374 | } else if (adapter->dcb_set_bitmap & BIT_PFC) { | ||
375 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | ||
376 | ixgbe_dcb_config_pfc_82598(&adapter->hw, | ||
377 | &adapter->dcb_cfg); | ||
378 | else if (adapter->hw.mac.type == ixgbe_mac_82599EB) | ||
379 | ixgbe_dcb_config_pfc_82599(&adapter->hw, | ||
380 | &adapter->dcb_cfg); | ||
381 | ret = DCB_HW_CHG; | ||
382 | } | ||
352 | if (adapter->dcb_cfg.pfc_mode_enable) | 383 | if (adapter->dcb_cfg.pfc_mode_enable) |
353 | adapter->hw.fc.current_mode = ixgbe_fc_pfc; | 384 | adapter->hw.fc.current_mode = ixgbe_fc_pfc; |
354 | 385 | ||
386 | if (adapter->dcb_set_bitmap & BIT_RESETLINK) | ||
387 | clear_bit(__IXGBE_RESETTING, &adapter->state); | ||
355 | adapter->dcb_set_bitmap = 0x00; | 388 | adapter->dcb_set_bitmap = 0x00; |
356 | clear_bit(__IXGBE_RESETTING, &adapter->state); | ||
357 | return ret; | 389 | return ret; |
358 | } | 390 | } |
359 | 391 | ||