aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_82598.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_82598.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c115
1 files changed, 31 insertions, 84 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 88e8350aa786..b9923047ce11 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -293,6 +293,17 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
293 u32 rmcs_reg; 293 u32 rmcs_reg;
294 u32 reg; 294 u32 reg;
295 295
296#ifdef CONFIG_DCB
297 if (hw->fc.requested_mode == ixgbe_fc_pfc)
298 goto out;
299
300#endif /* CONFIG_DCB */
301 /* Negotiate the fc mode to use */
302 ret_val = ixgbe_fc_autoneg(hw);
303 if (ret_val)
304 goto out;
305
306 /* Disable any previous flow control settings */
296 fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL); 307 fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
297 fctrl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE); 308 fctrl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE);
298 309
@@ -304,14 +315,20 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
304 * 0: Flow control is completely disabled 315 * 0: Flow control is completely disabled
305 * 1: Rx flow control is enabled (we can receive pause frames, 316 * 1: Rx flow control is enabled (we can receive pause frames,
306 * but not send pause frames). 317 * but not send pause frames).
307 * 2: Tx flow control is enabled (we can send pause frames but 318 * 2: Tx flow control is enabled (we can send pause frames but
308 * we do not support receiving pause frames). 319 * we do not support receiving pause frames).
309 * 3: Both Rx and Tx flow control (symmetric) are enabled. 320 * 3: Both Rx and Tx flow control (symmetric) are enabled.
310 * other: Invalid. 321 * other: Invalid.
322#ifdef CONFIG_DCB
323 * 4: Priority Flow Control is enabled.
324#endif
311 */ 325 */
312 switch (hw->fc.current_mode) { 326 switch (hw->fc.current_mode) {
313 case ixgbe_fc_none: 327 case ixgbe_fc_none:
314 /* Flow control completely disabled by software override. */ 328 /*
329 * Flow control is disabled by software override or autoneg.
330 * The code below will actually disable it in the HW.
331 */
315 break; 332 break;
316 case ixgbe_fc_rx_pause: 333 case ixgbe_fc_rx_pause:
317 /* 334 /*
@@ -336,6 +353,11 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
336 fctrl_reg |= IXGBE_FCTRL_RFCE; 353 fctrl_reg |= IXGBE_FCTRL_RFCE;
337 rmcs_reg |= IXGBE_RMCS_TFCE_802_3X; 354 rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
338 break; 355 break;
356#ifdef CONFIG_DCB
357 case ixgbe_fc_pfc:
358 goto out;
359 break;
360#endif /* CONFIG_DCB */
339 default: 361 default:
340 hw_dbg(hw, "Flow control param set incorrectly\n"); 362 hw_dbg(hw, "Flow control param set incorrectly\n");
341 ret_val = -IXGBE_ERR_CONFIG; 363 ret_val = -IXGBE_ERR_CONFIG;
@@ -343,7 +365,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
343 break; 365 break;
344 } 366 }
345 367
346 /* Enable 802.3x based flow control settings. */ 368 /* Set 802.3x based flow control settings. */
347 fctrl_reg |= IXGBE_FCTRL_DPF; 369 fctrl_reg |= IXGBE_FCTRL_DPF;
348 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl_reg); 370 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl_reg);
349 IXGBE_WRITE_REG(hw, IXGBE_RMCS, rmcs_reg); 371 IXGBE_WRITE_REG(hw, IXGBE_RMCS, rmcs_reg);
@@ -377,79 +399,6 @@ out:
377} 399}
378 400
379/** 401/**
380 * ixgbe_setup_fc_82598 - Configure flow control settings
381 * @hw: pointer to hardware structure
382 * @packetbuf_num: packet buffer number (0-7)
383 *
384 * Configures the flow control settings based on SW configuration. This
385 * function is used for 802.3x flow control configuration only.
386 **/
387static s32 ixgbe_setup_fc_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
388{
389 s32 ret_val = 0;
390 ixgbe_link_speed speed;
391 bool link_up;
392
393 /* Validate the packetbuf configuration */
394 if (packetbuf_num < 0 || packetbuf_num > 7) {
395 hw_dbg(hw, "Invalid packet buffer number [%d], expected range is"
396 " 0-7\n", packetbuf_num);
397 ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
398 goto out;
399 }
400
401 /*
402 * Validate the water mark configuration. Zero water marks are invalid
403 * because it causes the controller to just blast out fc packets.
404 */
405 if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) {
406 if (hw->fc.requested_mode != ixgbe_fc_none) {
407 hw_dbg(hw, "Invalid water mark configuration\n");
408 ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
409 goto out;
410 }
411 }
412
413 /*
414 * Validate the requested mode. Strict IEEE mode does not allow
415 * ixgbe_fc_rx_pause because it will cause testing anomalies.
416 */
417 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
418 hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
419 ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
420 goto out;
421 }
422
423 /*
424 * 10gig parts do not have a word in the EEPROM to determine the
425 * default flow control setting, so we explicitly set it to full.
426 */
427 if (hw->fc.requested_mode == ixgbe_fc_default)
428 hw->fc.requested_mode = ixgbe_fc_full;
429
430 /*
431 * Save off the requested flow control mode for use later. Depending
432 * on the link partner's capabilities, we may or may not use this mode.
433 */
434
435 hw->fc.current_mode = hw->fc.requested_mode;
436
437 /* Decide whether to use autoneg or not. */
438 hw->mac.ops.check_link(hw, &speed, &link_up, false);
439 if (!hw->fc.disable_fc_autoneg && hw->phy.multispeed_fiber &&
440 (speed == IXGBE_LINK_SPEED_1GB_FULL))
441 ret_val = ixgbe_fc_autoneg(hw);
442
443 if (ret_val)
444 goto out;
445
446 ret_val = ixgbe_fc_enable_82598(hw, packetbuf_num);
447
448out:
449 return ret_val;
450}
451
452/**
453 * ixgbe_setup_mac_link_82598 - Configures MAC link settings 402 * ixgbe_setup_mac_link_82598 - Configures MAC link settings
454 * @hw: pointer to hardware structure 403 * @hw: pointer to hardware structure
455 * 404 *
@@ -488,13 +437,6 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
488 } 437 }
489 } 438 }
490 439
491 /*
492 * We want to save off the original Flow Control configuration just in
493 * case we get disconnected and then reconnected into a different hub
494 * or switch with different Flow Control capabilities.
495 */
496 ixgbe_setup_fc_82598(hw, 0);
497
498 /* Add delay to filter out noises during initial link setup */ 440 /* Add delay to filter out noises during initial link setup */
499 msleep(50); 441 msleep(50);
500 442
@@ -581,6 +523,11 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
581 else 523 else
582 *speed = IXGBE_LINK_SPEED_1GB_FULL; 524 *speed = IXGBE_LINK_SPEED_1GB_FULL;
583 525
526 /* if link is down, zero out the current_mode */
527 if (*link_up == false) {
528 hw->fc.current_mode = ixgbe_fc_none;
529 hw->fc.fc_was_autonegged = false;
530 }
584out: 531out:
585 return 0; 532 return 0;
586} 533}
@@ -1168,7 +1115,7 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1168 .disable_mc = &ixgbe_disable_mc_generic, 1115 .disable_mc = &ixgbe_disable_mc_generic,
1169 .clear_vfta = &ixgbe_clear_vfta_82598, 1116 .clear_vfta = &ixgbe_clear_vfta_82598,
1170 .set_vfta = &ixgbe_set_vfta_82598, 1117 .set_vfta = &ixgbe_set_vfta_82598,
1171 .setup_fc = &ixgbe_setup_fc_82598, 1118 .fc_enable = &ixgbe_fc_enable_82598,
1172}; 1119};
1173 1120
1174static struct ixgbe_eeprom_operations eeprom_ops_82598 = { 1121static struct ixgbe_eeprom_operations eeprom_ops_82598 = {