提交 4b1a9877 编写于 作者: A Alexander Duyck 提交者: David S. Miller

igb: remove redundant timer updates and cleanup watchdog_task

The igb watchdog task is modifying the watchdog timer twice duing a single
run.  It only needs to be called once to reschedule itself for 2 seconds from
the last time it ran.

In addition I removed the allocation of the mac_info structure since it is
only called twice and is easier to access via the e1000_hw struct.
Signed-off-by: NAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 eebbbdba
...@@ -2314,13 +2314,10 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -2314,13 +2314,10 @@ static void igb_watchdog_task(struct work_struct *work)
struct igb_adapter *adapter = container_of(work, struct igb_adapter *adapter = container_of(work,
struct igb_adapter, watchdog_task); struct igb_adapter, 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;
struct igb_ring *tx_ring = adapter->tx_ring; struct igb_ring *tx_ring = adapter->tx_ring;
struct e1000_mac_info *mac = &adapter->hw.mac;
u32 link; u32 link;
u32 eics = 0; u32 eics = 0;
s32 ret_val;
int i; int i;
link = igb_has_link(adapter); link = igb_has_link(adapter);
...@@ -2365,6 +2362,7 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -2365,6 +2362,7 @@ static void igb_watchdog_task(struct work_struct *work)
netif_carrier_on(netdev); netif_carrier_on(netdev);
netif_tx_wake_all_queues(netdev); netif_tx_wake_all_queues(netdev);
/* link state has changed, schedule phy info update */
if (!test_bit(__IGB_DOWN, &adapter->state)) if (!test_bit(__IGB_DOWN, &adapter->state))
mod_timer(&adapter->phy_info_timer, mod_timer(&adapter->phy_info_timer,
round_jiffies(jiffies + 2 * HZ)); round_jiffies(jiffies + 2 * HZ));
...@@ -2378,6 +2376,8 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -2378,6 +2376,8 @@ static void igb_watchdog_task(struct work_struct *work)
netdev->name); netdev->name);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev); netif_tx_stop_all_queues(netdev);
/* link state has changed, schedule phy info update */
if (!test_bit(__IGB_DOWN, &adapter->state)) if (!test_bit(__IGB_DOWN, &adapter->state))
mod_timer(&adapter->phy_info_timer, mod_timer(&adapter->phy_info_timer,
round_jiffies(jiffies + 2 * HZ)); round_jiffies(jiffies + 2 * HZ));
...@@ -2387,9 +2387,9 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -2387,9 +2387,9 @@ static void igb_watchdog_task(struct work_struct *work)
link_up: link_up:
igb_update_stats(adapter); igb_update_stats(adapter);
mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; hw->mac.tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
adapter->tpt_old = adapter->stats.tpt; adapter->tpt_old = adapter->stats.tpt;
mac->collision_delta = adapter->stats.colc - adapter->colc_old; hw->mac.collision_delta = adapter->stats.colc - adapter->colc_old;
adapter->colc_old = adapter->stats.colc; adapter->colc_old = adapter->stats.colc;
adapter->gorc = adapter->stats.gorc - adapter->gorc_old; adapter->gorc = adapter->stats.gorc - adapter->gorc_old;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册