Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgbe: avoid duplicate code in suspend and stop paths

Resume path calls .open but suspend path cannot call .stop because
fdirs should not be freed and control over hardware should not be
released until WoL is configured. To avoid having to duplicate all
changes made in .stop on suspend path split out part of .stop that
is relevant during suspend and call it from .stop and during suspend.

This fix also ensures that ixgbe_ptp_suspend is called during the
suspend path, and helps avoid similar errors. We can't call
ixgbe_ptp_stop, since it will free the PTP clock device, which we
shouldn't be doing during a suspend path.

Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Jacob Keller and committed by
Jeff Kirsher
a0cccce2 9966d1ee

+14 -11
+14 -11
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 5659 5659 return err; 5660 5660 } 5661 5661 5662 + static void ixgbe_close_suspend(struct ixgbe_adapter *adapter) 5663 + { 5664 + ixgbe_ptp_suspend(adapter); 5665 + 5666 + ixgbe_down(adapter); 5667 + ixgbe_free_irq(adapter); 5668 + 5669 + ixgbe_free_all_tx_resources(adapter); 5670 + ixgbe_free_all_rx_resources(adapter); 5671 + } 5672 + 5662 5673 /** 5663 5674 * ixgbe_close - Disables a network interface 5664 5675 * @netdev: network interface device structure ··· 5687 5676 5688 5677 ixgbe_ptp_stop(adapter); 5689 5678 5690 - ixgbe_down(adapter); 5691 - ixgbe_free_irq(adapter); 5679 + ixgbe_close_suspend(adapter); 5692 5680 5693 5681 ixgbe_fdir_filter_exit(adapter); 5694 - 5695 - ixgbe_free_all_tx_resources(adapter); 5696 - ixgbe_free_all_rx_resources(adapter); 5697 5682 5698 5683 ixgbe_release_hw_control(adapter); 5699 5684 ··· 5757 5750 netif_device_detach(netdev); 5758 5751 5759 5752 rtnl_lock(); 5760 - if (netif_running(netdev)) { 5761 - ixgbe_down(adapter); 5762 - ixgbe_free_irq(adapter); 5763 - ixgbe_free_all_tx_resources(adapter); 5764 - ixgbe_free_all_rx_resources(adapter); 5765 - } 5753 + if (netif_running(netdev)) 5754 + ixgbe_close_suspend(adapter); 5766 5755 rtnl_unlock(); 5767 5756 5768 5757 ixgbe_clear_interrupt_scheme(adapter);