diff options
author | Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com> | 2009-09-01 09:49:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-01 20:40:14 -0400 |
commit | 8620a103b5e38d952280f3d97b5e1bcce8d7874c (patch) | |
tree | edb7b63d24fe6208529cef8fadffbdcd12972f6e | |
parent | fd38d7a0a0618656e491ed67af735bc4e3600367 (diff) |
ixgbe: refactor link setup code
Link code cleanup: a number of redundant functions and MAC variables are cleaned up,
with some functions being consolidated into a single-purpose code path.
Removed following deprecated link functions and mac variables
* ixgbe_setup_copper_link_speed_82598
* ixgbe_setup_mac_link_speed_multispeed_fiber
* ixgbe_setup_mac_link_speed_82599
* mac.autoneg, mac.autoneg_succeeded, phy.autoneg_wait_to_complete
Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>
Acked-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>
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82598.c | 49 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82599.c | 135 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 4 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 17 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 7 |
5 files changed, 67 insertions, 145 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 916430f2a7e7..cb7f0c3c6e16 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -41,8 +41,7 @@ | |||
41 | static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw, | 41 | static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw, |
42 | ixgbe_link_speed *speed, | 42 | ixgbe_link_speed *speed, |
43 | bool *autoneg); | 43 | bool *autoneg); |
44 | static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw); | 44 | static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, |
45 | static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw, | ||
46 | ixgbe_link_speed speed, | 45 | ixgbe_link_speed speed, |
47 | bool autoneg, | 46 | bool autoneg, |
48 | bool autoneg_wait_to_complete); | 47 | bool autoneg_wait_to_complete); |
@@ -156,8 +155,6 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) | |||
156 | /* Overwrite the link function pointers if copper PHY */ | 155 | /* Overwrite the link function pointers if copper PHY */ |
157 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { | 156 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { |
158 | mac->ops.setup_link = &ixgbe_setup_copper_link_82598; | 157 | mac->ops.setup_link = &ixgbe_setup_copper_link_82598; |
159 | mac->ops.setup_link_speed = | ||
160 | &ixgbe_setup_copper_link_speed_82598; | ||
161 | mac->ops.get_link_capabilities = | 158 | mac->ops.get_link_capabilities = |
162 | &ixgbe_get_copper_link_capabilities_82598; | 159 | &ixgbe_get_copper_link_capabilities_82598; |
163 | } | 160 | } |
@@ -465,13 +462,14 @@ out: | |||
465 | } | 462 | } |
466 | 463 | ||
467 | /** | 464 | /** |
468 | * ixgbe_setup_mac_link_82598 - Configures MAC link settings | 465 | * ixgbe_start_mac_link_82598 - Configures MAC link settings |
469 | * @hw: pointer to hardware structure | 466 | * @hw: pointer to hardware structure |
470 | * | 467 | * |
471 | * Configures link settings based on values in the ixgbe_hw struct. | 468 | * Configures link settings based on values in the ixgbe_hw struct. |
472 | * Restarts the link. Performs autonegotiation if needed. | 469 | * Restarts the link. Performs autonegotiation if needed. |
473 | **/ | 470 | **/ |
474 | static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw) | 471 | static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, |
472 | bool autoneg_wait_to_complete) | ||
475 | { | 473 | { |
476 | u32 autoc_reg; | 474 | u32 autoc_reg; |
477 | u32 links_reg; | 475 | u32 links_reg; |
@@ -484,7 +482,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw) | |||
484 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | 482 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); |
485 | 483 | ||
486 | /* Only poll for autoneg to complete if specified to do so */ | 484 | /* Only poll for autoneg to complete if specified to do so */ |
487 | if (hw->phy.autoneg_wait_to_complete) { | 485 | if (autoneg_wait_to_complete) { |
488 | if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 486 | if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
489 | IXGBE_AUTOC_LMS_KX4_AN || | 487 | IXGBE_AUTOC_LMS_KX4_AN || |
490 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 488 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
@@ -600,7 +598,7 @@ out: | |||
600 | 598 | ||
601 | 599 | ||
602 | /** | 600 | /** |
603 | * ixgbe_setup_mac_link_speed_82598 - Set MAC link speed | 601 | * ixgbe_setup_mac_link_82598 - Set MAC link speed |
604 | * @hw: pointer to hardware structure | 602 | * @hw: pointer to hardware structure |
605 | * @speed: new link speed | 603 | * @speed: new link speed |
606 | * @autoneg: true if auto-negotiation enabled | 604 | * @autoneg: true if auto-negotiation enabled |
@@ -608,7 +606,7 @@ out: | |||
608 | * | 606 | * |
609 | * Set the link speed in the AUTOC register and restarts link. | 607 | * Set the link speed in the AUTOC register and restarts link. |
610 | **/ | 608 | **/ |
611 | static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw, | 609 | static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, |
612 | ixgbe_link_speed speed, bool autoneg, | 610 | ixgbe_link_speed speed, bool autoneg, |
613 | bool autoneg_wait_to_complete) | 611 | bool autoneg_wait_to_complete) |
614 | { | 612 | { |
@@ -638,14 +636,12 @@ static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw, | |||
638 | } | 636 | } |
639 | 637 | ||
640 | if (status == 0) { | 638 | if (status == 0) { |
641 | hw->phy.autoneg_wait_to_complete = autoneg_wait_to_complete; | ||
642 | |||
643 | /* | 639 | /* |
644 | * Setup and restart the link based on the new values in | 640 | * Setup and restart the link based on the new values in |
645 | * ixgbe_hw This will write the AUTOC register based on the new | 641 | * ixgbe_hw This will write the AUTOC register based on the new |
646 | * stored values | 642 | * stored values |
647 | */ | 643 | */ |
648 | status = ixgbe_setup_mac_link_82598(hw); | 644 | status = ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); |
649 | } | 645 | } |
650 | 646 | ||
651 | return status; | 647 | return status; |
@@ -653,29 +649,7 @@ static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw, | |||
653 | 649 | ||
654 | 650 | ||
655 | /** | 651 | /** |
656 | * ixgbe_setup_copper_link_82598 - Setup copper link settings | 652 | * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field |
657 | * @hw: pointer to hardware structure | ||
658 | * | ||
659 | * Configures link settings based on values in the ixgbe_hw struct. | ||
660 | * Restarts the link. Performs autonegotiation if needed. Restart | ||
661 | * phy and wait for autonegotiate to finish. Then synchronize the | ||
662 | * MAC and PHY. | ||
663 | **/ | ||
664 | static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw) | ||
665 | { | ||
666 | s32 status; | ||
667 | |||
668 | /* Restart autonegotiation on PHY */ | ||
669 | status = hw->phy.ops.setup_link(hw); | ||
670 | |||
671 | /* Set up MAC */ | ||
672 | ixgbe_setup_mac_link_82598(hw); | ||
673 | |||
674 | return status; | ||
675 | } | ||
676 | |||
677 | /** | ||
678 | * ixgbe_setup_copper_link_speed_82598 - Set the PHY autoneg advertised field | ||
679 | * @hw: pointer to hardware structure | 653 | * @hw: pointer to hardware structure |
680 | * @speed: new link speed | 654 | * @speed: new link speed |
681 | * @autoneg: true if autonegotiation enabled | 655 | * @autoneg: true if autonegotiation enabled |
@@ -683,7 +657,7 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw) | |||
683 | * | 657 | * |
684 | * Sets the link speed in the AUTOC register in the MAC and restarts link. | 658 | * Sets the link speed in the AUTOC register in the MAC and restarts link. |
685 | **/ | 659 | **/ |
686 | static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw, | 660 | static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, |
687 | ixgbe_link_speed speed, | 661 | ixgbe_link_speed speed, |
688 | bool autoneg, | 662 | bool autoneg, |
689 | bool autoneg_wait_to_complete) | 663 | bool autoneg_wait_to_complete) |
@@ -695,7 +669,7 @@ static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw, | |||
695 | autoneg_wait_to_complete); | 669 | autoneg_wait_to_complete); |
696 | 670 | ||
697 | /* Set up MAC */ | 671 | /* Set up MAC */ |
698 | ixgbe_setup_mac_link_82598(hw); | 672 | ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); |
699 | 673 | ||
700 | return status; | 674 | return status; |
701 | } | 675 | } |
@@ -1163,7 +1137,6 @@ static struct ixgbe_mac_operations mac_ops_82598 = { | |||
1163 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, | 1137 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, |
1164 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, | 1138 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, |
1165 | .setup_link = &ixgbe_setup_mac_link_82598, | 1139 | .setup_link = &ixgbe_setup_mac_link_82598, |
1166 | .setup_link_speed = &ixgbe_setup_mac_link_speed_82598, | ||
1167 | .check_link = &ixgbe_check_mac_link_82598, | 1140 | .check_link = &ixgbe_check_mac_link_82598, |
1168 | .get_link_capabilities = &ixgbe_get_link_capabilities_82598, | 1141 | .get_link_capabilities = &ixgbe_get_link_capabilities_82598, |
1169 | .led_on = &ixgbe_led_on_generic, | 1142 | .led_on = &ixgbe_led_on_generic, |
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index 364b6d2279e4..5ee560855268 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -38,23 +38,23 @@ | |||
38 | #define IXGBE_82599_MC_TBL_SIZE 128 | 38 | #define IXGBE_82599_MC_TBL_SIZE 128 |
39 | #define IXGBE_82599_VFT_TBL_SIZE 128 | 39 | #define IXGBE_82599_VFT_TBL_SIZE 128 |
40 | 40 | ||
41 | static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw); | 41 | s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, |
42 | static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, | 42 | ixgbe_link_speed speed, |
43 | ixgbe_link_speed speed, bool autoneg, | 43 | bool autoneg, |
44 | bool autoneg_wait_to_complete); | 44 | bool autoneg_wait_to_complete); |
45 | static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw); | 45 | s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, |
46 | static s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw, | 46 | bool autoneg_wait_to_complete); |
47 | ixgbe_link_speed speed, | 47 | s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, |
48 | bool autoneg, | 48 | ixgbe_link_speed speed, |
49 | bool autoneg_wait_to_complete); | 49 | bool autoneg, |
50 | bool autoneg_wait_to_complete); | ||
50 | static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, | 51 | static s32 ixgbe_get_copper_link_capabilities_82599(struct ixgbe_hw *hw, |
51 | ixgbe_link_speed *speed, | 52 | ixgbe_link_speed *speed, |
52 | bool *autoneg); | 53 | bool *autoneg); |
53 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw); | 54 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, |
54 | static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, | 55 | ixgbe_link_speed speed, |
55 | ixgbe_link_speed speed, | 56 | bool autoneg, |
56 | bool autoneg, | 57 | bool autoneg_wait_to_complete); |
57 | bool autoneg_wait_to_complete); | ||
58 | static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); | 58 | static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); |
59 | 59 | ||
60 | static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) | 60 | static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) |
@@ -62,15 +62,9 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) | |||
62 | struct ixgbe_mac_info *mac = &hw->mac; | 62 | struct ixgbe_mac_info *mac = &hw->mac; |
63 | if (hw->phy.multispeed_fiber) { | 63 | if (hw->phy.multispeed_fiber) { |
64 | /* Set up dual speed SFP+ support */ | 64 | /* Set up dual speed SFP+ support */ |
65 | mac->ops.setup_link = | 65 | mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber; |
66 | &ixgbe_setup_mac_link_multispeed_fiber; | ||
67 | mac->ops.setup_link_speed = | ||
68 | &ixgbe_setup_mac_link_speed_multispeed_fiber; | ||
69 | } else { | 66 | } else { |
70 | mac->ops.setup_link = | 67 | mac->ops.setup_link = &ixgbe_setup_mac_link_82599; |
71 | &ixgbe_setup_mac_link_82599; | ||
72 | mac->ops.setup_link_speed = | ||
73 | &ixgbe_setup_mac_link_speed_82599; | ||
74 | } | 68 | } |
75 | } | 69 | } |
76 | 70 | ||
@@ -178,8 +172,6 @@ static s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw) | |||
178 | /* If copper media, overwrite with copper function pointers */ | 172 | /* If copper media, overwrite with copper function pointers */ |
179 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { | 173 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { |
180 | mac->ops.setup_link = &ixgbe_setup_copper_link_82599; | 174 | mac->ops.setup_link = &ixgbe_setup_copper_link_82599; |
181 | mac->ops.setup_link_speed = | ||
182 | &ixgbe_setup_copper_link_speed_82599; | ||
183 | mac->ops.get_link_capabilities = | 175 | mac->ops.get_link_capabilities = |
184 | &ixgbe_get_copper_link_capabilities_82599; | 176 | &ixgbe_get_copper_link_capabilities_82599; |
185 | } | 177 | } |
@@ -354,13 +346,15 @@ out: | |||
354 | } | 346 | } |
355 | 347 | ||
356 | /** | 348 | /** |
357 | * ixgbe_setup_mac_link_82599 - Setup MAC link settings | 349 | * ixgbe_start_mac_link_82599 - Setup MAC link settings |
358 | * @hw: pointer to hardware structure | 350 | * @hw: pointer to hardware structure |
351 | * @autoneg_wait_to_complete: true when waiting for completion is needed | ||
359 | * | 352 | * |
360 | * Configures link settings based on values in the ixgbe_hw struct. | 353 | * Configures link settings based on values in the ixgbe_hw struct. |
361 | * Restarts the link. Performs autonegotiation if needed. | 354 | * Restarts the link. Performs autonegotiation if needed. |
362 | **/ | 355 | **/ |
363 | static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw) | 356 | s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, |
357 | bool autoneg_wait_to_complete) | ||
364 | { | 358 | { |
365 | u32 autoc_reg; | 359 | u32 autoc_reg; |
366 | u32 links_reg; | 360 | u32 links_reg; |
@@ -373,7 +367,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw) | |||
373 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | 367 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); |
374 | 368 | ||
375 | /* Only poll for autoneg to complete if specified to do so */ | 369 | /* Only poll for autoneg to complete if specified to do so */ |
376 | if (hw->phy.autoneg_wait_to_complete) { | 370 | if (autoneg_wait_to_complete) { |
377 | if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 371 | if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
378 | IXGBE_AUTOC_LMS_KX4_KX_KR || | 372 | IXGBE_AUTOC_LMS_KX4_KX_KR || |
379 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 373 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
@@ -401,25 +395,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw) | |||
401 | } | 395 | } |
402 | 396 | ||
403 | /** | 397 | /** |
404 | * ixgbe_setup_mac_link_multispeed_fiber - Setup MAC link settings | 398 | * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed |
405 | * @hw: pointer to hardware structure | ||
406 | * | ||
407 | * Configures link settings based on values in the ixgbe_hw struct. | ||
408 | * Restarts the link for multi-speed fiber at 1G speed, if link | ||
409 | * fails at 10G. | ||
410 | * Performs autonegotiation if needed. | ||
411 | **/ | ||
412 | static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw) | ||
413 | { | ||
414 | s32 status = 0; | ||
415 | ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_82599_AUTONEG; | ||
416 | status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, link_speed, | ||
417 | true, true); | ||
418 | return status; | ||
419 | } | ||
420 | |||
421 | /** | ||
422 | * ixgbe_setup_mac_link_speed_multispeed_fiber - Set MAC link speed | ||
423 | * @hw: pointer to hardware structure | 399 | * @hw: pointer to hardware structure |
424 | * @speed: new link speed | 400 | * @speed: new link speed |
425 | * @autoneg: true if autonegotiation enabled | 401 | * @autoneg: true if autonegotiation enabled |
@@ -427,10 +403,10 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw) | |||
427 | * | 403 | * |
428 | * Set the link speed in the AUTOC register and restarts link. | 404 | * Set the link speed in the AUTOC register and restarts link. |
429 | **/ | 405 | **/ |
430 | static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, | 406 | s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, |
431 | ixgbe_link_speed speed, | 407 | ixgbe_link_speed speed, |
432 | bool autoneg, | 408 | bool autoneg, |
433 | bool autoneg_wait_to_complete) | 409 | bool autoneg_wait_to_complete) |
434 | { | 410 | { |
435 | s32 status = 0; | 411 | s32 status = 0; |
436 | ixgbe_link_speed phy_link_speed; | 412 | ixgbe_link_speed phy_link_speed; |
@@ -485,10 +461,10 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, | |||
485 | /* Allow module to change analog characteristics (1G->10G) */ | 461 | /* Allow module to change analog characteristics (1G->10G) */ |
486 | msleep(40); | 462 | msleep(40); |
487 | 463 | ||
488 | status = ixgbe_setup_mac_link_speed_82599(hw, | 464 | status = ixgbe_setup_mac_link_82599(hw, |
489 | IXGBE_LINK_SPEED_10GB_FULL, | 465 | IXGBE_LINK_SPEED_10GB_FULL, |
490 | autoneg, | 466 | autoneg, |
491 | autoneg_wait_to_complete); | 467 | autoneg_wait_to_complete); |
492 | if (status != 0) | 468 | if (status != 0) |
493 | goto out; | 469 | goto out; |
494 | 470 | ||
@@ -539,7 +515,7 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, | |||
539 | /* Allow module to change analog characteristics (10G->1G) */ | 515 | /* Allow module to change analog characteristics (10G->1G) */ |
540 | msleep(40); | 516 | msleep(40); |
541 | 517 | ||
542 | status = ixgbe_setup_mac_link_speed_82599(hw, | 518 | status = ixgbe_setup_mac_link_82599(hw, |
543 | IXGBE_LINK_SPEED_1GB_FULL, | 519 | IXGBE_LINK_SPEED_1GB_FULL, |
544 | autoneg, | 520 | autoneg, |
545 | autoneg_wait_to_complete); | 521 | autoneg_wait_to_complete); |
@@ -576,10 +552,10 @@ static s32 ixgbe_setup_mac_link_speed_multispeed_fiber(struct ixgbe_hw *hw, | |||
576 | * single highest speed that the user requested. | 552 | * single highest speed that the user requested. |
577 | */ | 553 | */ |
578 | if (speedcnt > 1) | 554 | if (speedcnt > 1) |
579 | status = ixgbe_setup_mac_link_speed_multispeed_fiber(hw, | 555 | status = ixgbe_setup_mac_link_multispeed_fiber(hw, |
580 | highest_link_speed, | 556 | highest_link_speed, |
581 | autoneg, | 557 | autoneg, |
582 | autoneg_wait_to_complete); | 558 | autoneg_wait_to_complete); |
583 | 559 | ||
584 | out: | 560 | out: |
585 | return status; | 561 | return status; |
@@ -640,7 +616,7 @@ static s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw, | |||
640 | } | 616 | } |
641 | 617 | ||
642 | /** | 618 | /** |
643 | * ixgbe_setup_mac_link_speed_82599 - Set MAC link speed | 619 | * ixgbe_setup_mac_link_82599 - Set MAC link speed |
644 | * @hw: pointer to hardware structure | 620 | * @hw: pointer to hardware structure |
645 | * @speed: new link speed | 621 | * @speed: new link speed |
646 | * @autoneg: true if autonegotiation enabled | 622 | * @autoneg: true if autonegotiation enabled |
@@ -648,10 +624,9 @@ static s32 ixgbe_check_mac_link_82599(struct ixgbe_hw *hw, | |||
648 | * | 624 | * |
649 | * Set the link speed in the AUTOC register and restarts link. | 625 | * Set the link speed in the AUTOC register and restarts link. |
650 | **/ | 626 | **/ |
651 | static s32 ixgbe_setup_mac_link_speed_82599(struct ixgbe_hw *hw, | 627 | s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, |
652 | ixgbe_link_speed speed, | 628 | ixgbe_link_speed speed, bool autoneg, |
653 | bool autoneg, | 629 | bool autoneg_wait_to_complete) |
654 | bool autoneg_wait_to_complete) | ||
655 | { | 630 | { |
656 | s32 status = 0; | 631 | s32 status = 0; |
657 | u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 632 | u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
@@ -751,26 +726,7 @@ out: | |||
751 | } | 726 | } |
752 | 727 | ||
753 | /** | 728 | /** |
754 | * ixgbe_setup_copper_link_82599 - Setup copper link settings | 729 | * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field |
755 | * @hw: pointer to hardware structure | ||
756 | * | ||
757 | * Restarts the link on PHY and then MAC. Performs autonegotiation if needed. | ||
758 | **/ | ||
759 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw) | ||
760 | { | ||
761 | s32 status; | ||
762 | |||
763 | /* Restart autonegotiation on PHY */ | ||
764 | status = hw->phy.ops.setup_link(hw); | ||
765 | |||
766 | /* Set up MAC */ | ||
767 | ixgbe_setup_mac_link_82599(hw); | ||
768 | |||
769 | return status; | ||
770 | } | ||
771 | |||
772 | /** | ||
773 | * ixgbe_setup_copper_link_speed_82599 - Set the PHY autoneg advertised field | ||
774 | * @hw: pointer to hardware structure | 730 | * @hw: pointer to hardware structure |
775 | * @speed: new link speed | 731 | * @speed: new link speed |
776 | * @autoneg: true if autonegotiation enabled | 732 | * @autoneg: true if autonegotiation enabled |
@@ -778,10 +734,10 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw) | |||
778 | * | 734 | * |
779 | * Restarts link on PHY and MAC based on settings passed in. | 735 | * Restarts link on PHY and MAC based on settings passed in. |
780 | **/ | 736 | **/ |
781 | static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, | 737 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, |
782 | ixgbe_link_speed speed, | 738 | ixgbe_link_speed speed, |
783 | bool autoneg, | 739 | bool autoneg, |
784 | bool autoneg_wait_to_complete) | 740 | bool autoneg_wait_to_complete) |
785 | { | 741 | { |
786 | s32 status; | 742 | s32 status; |
787 | 743 | ||
@@ -789,7 +745,7 @@ static s32 ixgbe_setup_copper_link_speed_82599(struct ixgbe_hw *hw, | |||
789 | status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, | 745 | status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, |
790 | autoneg_wait_to_complete); | 746 | autoneg_wait_to_complete); |
791 | /* Set up MAC */ | 747 | /* Set up MAC */ |
792 | ixgbe_setup_mac_link_82599(hw); | 748 | ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete); |
793 | 749 | ||
794 | return status; | 750 | return status; |
795 | } | 751 | } |
@@ -2470,7 +2426,6 @@ static struct ixgbe_mac_operations mac_ops_82599 = { | |||
2470 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, | 2426 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, |
2471 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, | 2427 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, |
2472 | .setup_link = &ixgbe_setup_mac_link_82599, | 2428 | .setup_link = &ixgbe_setup_mac_link_82599, |
2473 | .setup_link_speed = &ixgbe_setup_mac_link_speed_82599, | ||
2474 | .check_link = &ixgbe_check_mac_link_82599, | 2429 | .check_link = &ixgbe_check_mac_link_82599, |
2475 | .get_link_capabilities = &ixgbe_get_link_capabilities_82599, | 2430 | .get_link_capabilities = &ixgbe_get_link_capabilities_82599, |
2476 | .led_on = &ixgbe_led_on_generic, | 2431 | .led_on = &ixgbe_led_on_generic, |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 1444ec512536..026e94a99849 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -233,11 +233,11 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
233 | return err; | 233 | return err; |
234 | /* this sets the link speed and restarts auto-neg */ | 234 | /* this sets the link speed and restarts auto-neg */ |
235 | hw->mac.autotry_restart = true; | 235 | hw->mac.autotry_restart = true; |
236 | err = hw->mac.ops.setup_link_speed(hw, advertised, true, true); | 236 | err = hw->mac.ops.setup_link(hw, advertised, true, true); |
237 | if (err) { | 237 | if (err) { |
238 | DPRINTK(PROBE, INFO, | 238 | DPRINTK(PROBE, INFO, |
239 | "setup link failed with code %d\n", err); | 239 | "setup link failed with code %d\n", err); |
240 | hw->mac.ops.setup_link_speed(hw, old, true, true); | 240 | hw->mac.ops.setup_link(hw, old, true, true); |
241 | } | 241 | } |
242 | } else { | 242 | } else { |
243 | /* in this case we currently only support 10Gb/FULL */ | 243 | /* in this case we currently only support 10Gb/FULL */ |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index f907836eed22..4042d878670e 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2516,7 +2516,7 @@ static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) | |||
2516 | static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) | 2516 | static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) |
2517 | { | 2517 | { |
2518 | u32 autoneg; | 2518 | u32 autoneg; |
2519 | bool link_up = false; | 2519 | bool negotiation, link_up = false; |
2520 | u32 ret = IXGBE_ERR_LINK_SETUP; | 2520 | u32 ret = IXGBE_ERR_LINK_SETUP; |
2521 | 2521 | ||
2522 | if (hw->mac.ops.check_link) | 2522 | if (hw->mac.ops.check_link) |
@@ -2526,13 +2526,12 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) | |||
2526 | goto link_cfg_out; | 2526 | goto link_cfg_out; |
2527 | 2527 | ||
2528 | if (hw->mac.ops.get_link_capabilities) | 2528 | if (hw->mac.ops.get_link_capabilities) |
2529 | ret = hw->mac.ops.get_link_capabilities(hw, &autoneg, | 2529 | ret = hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation); |
2530 | &hw->mac.autoneg); | ||
2531 | if (ret) | 2530 | if (ret) |
2532 | goto link_cfg_out; | 2531 | goto link_cfg_out; |
2533 | 2532 | ||
2534 | if (hw->mac.ops.setup_link_speed) | 2533 | if (hw->mac.ops.setup_link) |
2535 | ret = hw->mac.ops.setup_link_speed(hw, autoneg, true, link_up); | 2534 | ret = hw->mac.ops.setup_link(hw, autoneg, negotiation, link_up); |
2536 | link_cfg_out: | 2535 | link_cfg_out: |
2537 | return ret; | 2536 | return ret; |
2538 | } | 2537 | } |
@@ -4517,14 +4516,14 @@ static void ixgbe_multispeed_fiber_task(struct work_struct *work) | |||
4517 | multispeed_fiber_task); | 4516 | multispeed_fiber_task); |
4518 | struct ixgbe_hw *hw = &adapter->hw; | 4517 | struct ixgbe_hw *hw = &adapter->hw; |
4519 | u32 autoneg; | 4518 | u32 autoneg; |
4519 | bool negotiation; | ||
4520 | 4520 | ||
4521 | adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK; | 4521 | adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK; |
4522 | autoneg = hw->phy.autoneg_advertised; | 4522 | autoneg = hw->phy.autoneg_advertised; |
4523 | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | 4523 | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) |
4524 | hw->mac.ops.get_link_capabilities(hw, &autoneg, | 4524 | hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation); |
4525 | &hw->mac.autoneg); | 4525 | if (hw->mac.ops.setup_link) |
4526 | if (hw->mac.ops.setup_link_speed) | 4526 | hw->mac.ops.setup_link(hw, autoneg, negotiation, true); |
4527 | hw->mac.ops.setup_link_speed(hw, autoneg, true, true); | ||
4528 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; | 4527 | adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; |
4529 | adapter->flags &= ~IXGBE_FLAG_IN_SFP_LINK_TASK; | 4528 | adapter->flags &= ~IXGBE_FLAG_IN_SFP_LINK_TASK; |
4530 | } | 4529 | } |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index f0f3406ef001..8ba90eec1dc9 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -2332,9 +2332,7 @@ struct ixgbe_mac_operations { | |||
2332 | s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); | 2332 | s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); |
2333 | 2333 | ||
2334 | /* Link */ | 2334 | /* Link */ |
2335 | s32 (*setup_link)(struct ixgbe_hw *); | 2335 | s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool); |
2336 | s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool, | ||
2337 | bool); | ||
2338 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); | 2336 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); |
2339 | s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, | 2337 | s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, |
2340 | bool *); | 2338 | bool *); |
@@ -2406,8 +2404,6 @@ struct ixgbe_mac_info { | |||
2406 | u32 orig_autoc; | 2404 | u32 orig_autoc; |
2407 | u32 orig_autoc2; | 2405 | u32 orig_autoc2; |
2408 | bool orig_link_settings_stored; | 2406 | bool orig_link_settings_stored; |
2409 | bool autoneg; | ||
2410 | bool autoneg_succeeded; | ||
2411 | bool autotry_restart; | 2407 | bool autotry_restart; |
2412 | }; | 2408 | }; |
2413 | 2409 | ||
@@ -2422,7 +2418,6 @@ struct ixgbe_phy_info { | |||
2422 | enum ixgbe_media_type media_type; | 2418 | enum ixgbe_media_type media_type; |
2423 | bool reset_disable; | 2419 | bool reset_disable; |
2424 | ixgbe_autoneg_advertised autoneg_advertised; | 2420 | ixgbe_autoneg_advertised autoneg_advertised; |
2425 | bool autoneg_wait_to_complete; | ||
2426 | bool multispeed_fiber; | 2421 | bool multispeed_fiber; |
2427 | }; | 2422 | }; |
2428 | 2423 | ||