Commit 3b7178a9 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Kleber Sacilotto de Souza

e1000e: start network tx queue only when link is up

BugLink: https://bugs.launchpad.net/bugs/1838467

commit d17ba0f6 upstream.

Driver does not want to keep packets in Tx queue when link is lost.
But present code only reset NIC to flush them, but does not prevent
queuing new packets. Moreover reset sequence itself could generate
new packets via netconsole and NIC falls into endless reset loop.

This patch wakes Tx queue only when NIC is ready to send packets.

This is proper fix for problem addressed by commit 0f9e980b
("e1000e: fix cyclic resets at link up with active tx").
Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Suggested-by: default avatarAlexander Duyck <alexander.duyck@gmail.com>
Tested-by: default avatarJoseph Yasi <joe.yasi@gmail.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Tested-by: default avatarOleksandr Natalenko <oleksandr@redhat.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent d0c1d967
...@@ -4187,7 +4187,7 @@ void e1000e_up(struct e1000_adapter *adapter) ...@@ -4187,7 +4187,7 @@ void e1000e_up(struct e1000_adapter *adapter)
e1000_configure_msix(adapter); e1000_configure_msix(adapter);
e1000_irq_enable(adapter); e1000_irq_enable(adapter);
netif_start_queue(adapter->netdev); /* Tx queue started by watchdog timer when link is up */
e1000e_trigger_lsc(adapter); e1000e_trigger_lsc(adapter);
} }
...@@ -4549,6 +4549,7 @@ static int e1000_open(struct net_device *netdev) ...@@ -4549,6 +4549,7 @@ static int e1000_open(struct net_device *netdev)
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
/* allocate transmit descriptors */ /* allocate transmit descriptors */
err = e1000e_setup_tx_resources(adapter->tx_ring); err = e1000e_setup_tx_resources(adapter->tx_ring);
...@@ -4609,7 +4610,6 @@ static int e1000_open(struct net_device *netdev) ...@@ -4609,7 +4610,6 @@ static int e1000_open(struct net_device *netdev)
e1000_irq_enable(adapter); e1000_irq_enable(adapter);
adapter->tx_hang_recheck = false; adapter->tx_hang_recheck = false;
netif_start_queue(netdev);
hw->mac.get_link_status = true; hw->mac.get_link_status = true;
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
...@@ -5232,6 +5232,7 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -5232,6 +5232,7 @@ static void e1000_watchdog_task(struct work_struct *work)
if (phy->ops.cfg_on_link_up) if (phy->ops.cfg_on_link_up)
phy->ops.cfg_on_link_up(hw); phy->ops.cfg_on_link_up(hw);
netif_wake_queue(netdev);
netif_carrier_on(netdev); netif_carrier_on(netdev);
if (!test_bit(__E1000_DOWN, &adapter->state)) if (!test_bit(__E1000_DOWN, &adapter->state))
...@@ -5245,6 +5246,7 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -5245,6 +5246,7 @@ static void e1000_watchdog_task(struct work_struct *work)
/* Link status message must follow this format */ /* Link status message must follow this format */
pr_info("%s NIC Link is Down\n", adapter->netdev->name); pr_info("%s NIC Link is Down\n", adapter->netdev->name);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
if (!test_bit(__E1000_DOWN, &adapter->state)) if (!test_bit(__E1000_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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment