diff options
author | Stefan Assmann <sassmann@kpanic.de> | 2011-04-05 00:27:15 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-04-13 22:16:44 -0400 |
commit | 563988dcfe706457ec7049d59e18d6147179bb0a (patch) | |
tree | eba3ccc69a72c62099f192216aa6d66817b76e28 /drivers/net/igb | |
parent | 34a0326e3aaf1d67fe3de55e77e92961c6a9a847 (diff) |
igb: introduce igb_thermal_sensor_event for sensor checking
The code for thermal sensor checking should be wrapped into a function.
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/igb')
-rw-r--r-- | drivers/net/igb/igb_main.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 0dfd1b93829e..cdfd57271051 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -3532,6 +3532,25 @@ bool igb_has_link(struct igb_adapter *adapter) | |||
3532 | return link_active; | 3532 | return link_active; |
3533 | } | 3533 | } |
3534 | 3534 | ||
3535 | static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event) | ||
3536 | { | ||
3537 | bool ret = false; | ||
3538 | u32 ctrl_ext, thstat; | ||
3539 | |||
3540 | /* check for thermal sensor event on i350, copper only */ | ||
3541 | if (hw->mac.type == e1000_i350) { | ||
3542 | thstat = rd32(E1000_THSTAT); | ||
3543 | ctrl_ext = rd32(E1000_CTRL_EXT); | ||
3544 | |||
3545 | if ((hw->phy.media_type == e1000_media_type_copper) && | ||
3546 | !(ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII)) { | ||
3547 | ret = !!(thstat & event); | ||
3548 | } | ||
3549 | } | ||
3550 | |||
3551 | return ret; | ||
3552 | } | ||
3553 | |||
3535 | /** | 3554 | /** |
3536 | * igb_watchdog - Timer Call-back | 3555 | * igb_watchdog - Timer Call-back |
3537 | * @data: pointer to adapter cast into an unsigned long | 3556 | * @data: pointer to adapter cast into an unsigned long |
@@ -3550,7 +3569,7 @@ static void igb_watchdog_task(struct work_struct *work) | |||
3550 | watchdog_task); | 3569 | watchdog_task); |
3551 | struct e1000_hw *hw = &adapter->hw; | 3570 | struct e1000_hw *hw = &adapter->hw; |
3552 | struct net_device *netdev = adapter->netdev; | 3571 | struct net_device *netdev = adapter->netdev; |
3553 | u32 link, ctrl_ext, thstat; | 3572 | u32 link; |
3554 | int i; | 3573 | int i; |
3555 | 3574 | ||
3556 | link = igb_has_link(adapter); | 3575 | link = igb_has_link(adapter); |
@@ -3574,25 +3593,14 @@ static void igb_watchdog_task(struct work_struct *work) | |||
3574 | ((ctrl & E1000_CTRL_RFCE) ? "RX" : | 3593 | ((ctrl & E1000_CTRL_RFCE) ? "RX" : |
3575 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None"))); | 3594 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None"))); |
3576 | 3595 | ||
3577 | /* check for thermal sensor event on i350, | 3596 | /* check for thermal sensor event */ |
3578 | * copper only */ | 3597 | if (igb_thermal_sensor_event(hw, E1000_THSTAT_LINK_THROTTLE)) { |
3579 | if (hw->mac.type == e1000_i350) { | 3598 | printk(KERN_INFO "igb: %s The network adapter " |
3580 | thstat = rd32(E1000_THSTAT); | 3599 | "link speed was downshifted " |
3581 | ctrl_ext = rd32(E1000_CTRL_EXT); | 3600 | "because it overheated.\n", |
3582 | if ((hw->phy.media_type == | 3601 | netdev->name); |
3583 | e1000_media_type_copper) && !(ctrl_ext & | ||
3584 | E1000_CTRL_EXT_LINK_MODE_SGMII)) { | ||
3585 | if (thstat & | ||
3586 | E1000_THSTAT_LINK_THROTTLE) { | ||
3587 | printk(KERN_INFO "igb: %s The " | ||
3588 | "network adapter link " | ||
3589 | "speed was downshifted " | ||
3590 | "because it " | ||
3591 | "overheated.\n", | ||
3592 | netdev->name); | ||
3593 | } | ||
3594 | } | ||
3595 | } | 3602 | } |
3603 | |||
3596 | /* adjust timeout factor according to speed/duplex */ | 3604 | /* adjust timeout factor according to speed/duplex */ |
3597 | adapter->tx_timeout_factor = 1; | 3605 | adapter->tx_timeout_factor = 1; |
3598 | switch (adapter->link_speed) { | 3606 | switch (adapter->link_speed) { |
@@ -3618,22 +3626,15 @@ static void igb_watchdog_task(struct work_struct *work) | |||
3618 | if (netif_carrier_ok(netdev)) { | 3626 | if (netif_carrier_ok(netdev)) { |
3619 | adapter->link_speed = 0; | 3627 | adapter->link_speed = 0; |
3620 | adapter->link_duplex = 0; | 3628 | adapter->link_duplex = 0; |
3621 | /* check for thermal sensor event on i350 | 3629 | |
3622 | * copper only*/ | 3630 | /* check for thermal sensor event */ |
3623 | if (hw->mac.type == e1000_i350) { | 3631 | if (igb_thermal_sensor_event(hw, E1000_THSTAT_PWR_DOWN)) { |
3624 | thstat = rd32(E1000_THSTAT); | 3632 | printk(KERN_ERR "igb: %s The network adapter " |
3625 | ctrl_ext = rd32(E1000_CTRL_EXT); | 3633 | "was stopped because it " |
3626 | if ((hw->phy.media_type == | 3634 | "overheated.\n", |
3627 | e1000_media_type_copper) && !(ctrl_ext & | ||
3628 | E1000_CTRL_EXT_LINK_MODE_SGMII)) { | ||
3629 | if (thstat & E1000_THSTAT_PWR_DOWN) { | ||
3630 | printk(KERN_ERR "igb: %s The " | ||
3631 | "network adapter was stopped " | ||
3632 | "because it overheated.\n", | ||
3633 | netdev->name); | 3635 | netdev->name); |
3634 | } | ||
3635 | } | ||
3636 | } | 3636 | } |
3637 | |||
3637 | /* Links status message must follow this format */ | 3638 | /* Links status message must follow this format */ |
3638 | printk(KERN_INFO "igb: %s NIC Link is Down\n", | 3639 | printk(KERN_INFO "igb: %s NIC Link is Down\n", |
3639 | netdev->name); | 3640 | netdev->name); |