提交 563988dc 编写于 作者: S Stefan Assmann 提交者: Jeff Kirsher

igb: introduce igb_thermal_sensor_event for sensor checking

The code for thermal sensor checking should be wrapped into a function.
Signed-off-by: NStefan Assmann <sassmann@kpanic.de>
Tested-by: NJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 34a0326e
...@@ -3532,6 +3532,25 @@ bool igb_has_link(struct igb_adapter *adapter) ...@@ -3532,6 +3532,25 @@ bool igb_has_link(struct igb_adapter *adapter)
return link_active; return link_active;
} }
static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event)
{
bool ret = false;
u32 ctrl_ext, thstat;
/* check for thermal sensor event on i350, copper only */
if (hw->mac.type == e1000_i350) {
thstat = rd32(E1000_THSTAT);
ctrl_ext = rd32(E1000_CTRL_EXT);
if ((hw->phy.media_type == e1000_media_type_copper) &&
!(ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII)) {
ret = !!(thstat & event);
}
}
return ret;
}
/** /**
* igb_watchdog - Timer Call-back * igb_watchdog - Timer Call-back
* @data: pointer to adapter cast into an unsigned long * @data: pointer to adapter cast into an unsigned long
...@@ -3550,7 +3569,7 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -3550,7 +3569,7 @@ static void igb_watchdog_task(struct work_struct *work)
watchdog_task); watchdog_task);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
u32 link, ctrl_ext, thstat; u32 link;
int i; int i;
link = igb_has_link(adapter); link = igb_has_link(adapter);
...@@ -3574,25 +3593,14 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -3574,25 +3593,14 @@ static void igb_watchdog_task(struct work_struct *work)
((ctrl & E1000_CTRL_RFCE) ? "RX" : ((ctrl & E1000_CTRL_RFCE) ? "RX" :
((ctrl & E1000_CTRL_TFCE) ? "TX" : "None"))); ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None")));
/* check for thermal sensor event on i350, /* check for thermal sensor event */
* copper only */ if (igb_thermal_sensor_event(hw, E1000_THSTAT_LINK_THROTTLE)) {
if (hw->mac.type == e1000_i350) { printk(KERN_INFO "igb: %s The network adapter "
thstat = rd32(E1000_THSTAT); "link speed was downshifted "
ctrl_ext = rd32(E1000_CTRL_EXT); "because it overheated.\n",
if ((hw->phy.media_type == netdev->name);
e1000_media_type_copper) && !(ctrl_ext &
E1000_CTRL_EXT_LINK_MODE_SGMII)) {
if (thstat &
E1000_THSTAT_LINK_THROTTLE) {
printk(KERN_INFO "igb: %s The "
"network adapter link "
"speed was downshifted "
"because it "
"overheated.\n",
netdev->name);
}
}
} }
/* adjust timeout factor according to speed/duplex */ /* adjust timeout factor according to speed/duplex */
adapter->tx_timeout_factor = 1; adapter->tx_timeout_factor = 1;
switch (adapter->link_speed) { switch (adapter->link_speed) {
...@@ -3618,22 +3626,15 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -3618,22 +3626,15 @@ static void igb_watchdog_task(struct work_struct *work)
if (netif_carrier_ok(netdev)) { if (netif_carrier_ok(netdev)) {
adapter->link_speed = 0; adapter->link_speed = 0;
adapter->link_duplex = 0; adapter->link_duplex = 0;
/* check for thermal sensor event on i350
* copper only*/ /* check for thermal sensor event */
if (hw->mac.type == e1000_i350) { if (igb_thermal_sensor_event(hw, E1000_THSTAT_PWR_DOWN)) {
thstat = rd32(E1000_THSTAT); printk(KERN_ERR "igb: %s The network adapter "
ctrl_ext = rd32(E1000_CTRL_EXT); "was stopped because it "
if ((hw->phy.media_type == "overheated.\n",
e1000_media_type_copper) && !(ctrl_ext &
E1000_CTRL_EXT_LINK_MODE_SGMII)) {
if (thstat & E1000_THSTAT_PWR_DOWN) {
printk(KERN_ERR "igb: %s The "
"network adapter was stopped "
"because it overheated.\n",
netdev->name); netdev->name);
}
}
} }
/* Links status message must follow this format */ /* Links status message must follow this format */
printk(KERN_INFO "igb: %s NIC Link is Down\n", printk(KERN_INFO "igb: %s NIC Link is Down\n",
netdev->name); netdev->name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册