Commit c9f66b43 authored by David S. Miller's avatar David S. Miller

Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2020-06-16

This series contains fixes to e1000 and e1000e.

Chen fixes an e1000e issue where systems could be waken via WoL, even
though the user has disabled the wakeup bit via sysfs.

Vaibhav Gupta updates the e1000 driver to clean up the legacy Power
Management hooks.

Arnd Bergmann cleans up the inconsistent use CONFIG_PM_SLEEP
preprocessor tags, which also resolves the compiler warnings about the
possibility of unused structure.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ea12fe9d 880e6269
...@@ -151,10 +151,8 @@ static int e1000_vlan_rx_kill_vid(struct net_device *netdev, ...@@ -151,10 +151,8 @@ static int e1000_vlan_rx_kill_vid(struct net_device *netdev,
__be16 proto, u16 vid); __be16 proto, u16 vid);
static void e1000_restore_vlan(struct e1000_adapter *adapter); static void e1000_restore_vlan(struct e1000_adapter *adapter);
#ifdef CONFIG_PM static int __maybe_unused e1000_suspend(struct device *dev);
static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); static int __maybe_unused e1000_resume(struct device *dev);
static int e1000_resume(struct pci_dev *pdev);
#endif
static void e1000_shutdown(struct pci_dev *pdev); static void e1000_shutdown(struct pci_dev *pdev);
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
...@@ -179,16 +177,16 @@ static const struct pci_error_handlers e1000_err_handler = { ...@@ -179,16 +177,16 @@ static const struct pci_error_handlers e1000_err_handler = {
.resume = e1000_io_resume, .resume = e1000_io_resume,
}; };
static SIMPLE_DEV_PM_OPS(e1000_pm_ops, e1000_suspend, e1000_resume);
static struct pci_driver e1000_driver = { static struct pci_driver e1000_driver = {
.name = e1000_driver_name, .name = e1000_driver_name,
.id_table = e1000_pci_tbl, .id_table = e1000_pci_tbl,
.probe = e1000_probe, .probe = e1000_probe,
.remove = e1000_remove, .remove = e1000_remove,
#ifdef CONFIG_PM .driver = {
/* Power Management Hooks */ .pm = &e1000_pm_ops,
.suspend = e1000_suspend, },
.resume = e1000_resume,
#endif
.shutdown = e1000_shutdown, .shutdown = e1000_shutdown,
.err_handler = &e1000_err_handler .err_handler = &e1000_err_handler
}; };
...@@ -5060,9 +5058,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -5060,9 +5058,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 ctrl, ctrl_ext, rctl, status; u32 ctrl, ctrl_ext, rctl, status;
u32 wufc = adapter->wol; u32 wufc = adapter->wol;
#ifdef CONFIG_PM
int retval = 0;
#endif
netif_device_detach(netdev); netif_device_detach(netdev);
...@@ -5076,12 +5071,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -5076,12 +5071,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
e1000_down(adapter); e1000_down(adapter);
} }
#ifdef CONFIG_PM
retval = pci_save_state(pdev);
if (retval)
return retval;
#endif
status = er32(STATUS); status = er32(STATUS);
if (status & E1000_STATUS_LU) if (status & E1000_STATUS_LU)
wufc &= ~E1000_WUFC_LNKC; wufc &= ~E1000_WUFC_LNKC;
...@@ -5142,37 +5131,26 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) ...@@ -5142,37 +5131,26 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
return 0; return 0;
} }
#ifdef CONFIG_PM static int __maybe_unused e1000_suspend(struct device *dev)
static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
int retval; int retval;
struct pci_dev *pdev = to_pci_dev(dev);
bool wake; bool wake;
retval = __e1000_shutdown(pdev, &wake); retval = __e1000_shutdown(pdev, &wake);
if (retval) device_set_wakeup_enable(dev, wake);
return retval;
if (wake) {
pci_prepare_to_sleep(pdev);
} else {
pci_wake_from_d3(pdev, false);
pci_set_power_state(pdev, PCI_D3hot);
}
return 0; return retval;
} }
static int e1000_resume(struct pci_dev *pdev) static int __maybe_unused e1000_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 err; u32 err;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
pci_save_state(pdev);
if (adapter->need_ioport) if (adapter->need_ioport)
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
else else
...@@ -5209,7 +5187,6 @@ static int e1000_resume(struct pci_dev *pdev) ...@@ -5209,7 +5187,6 @@ static int e1000_resume(struct pci_dev *pdev)
return 0; return 0;
} }
#endif
static void e1000_shutdown(struct pci_dev *pdev) static void e1000_shutdown(struct pci_dev *pdev)
{ {
......
...@@ -6349,7 +6349,6 @@ static void e1000e_flush_lpic(struct pci_dev *pdev) ...@@ -6349,7 +6349,6 @@ static void e1000e_flush_lpic(struct pci_dev *pdev)
pm_runtime_put_sync(netdev->dev.parent); pm_runtime_put_sync(netdev->dev.parent);
} }
#ifdef CONFIG_PM_SLEEP
/* S0ix implementation */ /* S0ix implementation */
static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter) static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter)
{ {
...@@ -6571,7 +6570,6 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) ...@@ -6571,7 +6570,6 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter)
mac_data &= ~E1000_CTRL_EXT_FORCE_SMBUS; mac_data &= ~E1000_CTRL_EXT_FORCE_SMBUS;
ew32(CTRL_EXT, mac_data); ew32(CTRL_EXT, mac_data);
} }
#endif /* CONFIG_PM_SLEEP */
static int e1000e_pm_freeze(struct device *dev) static int e1000e_pm_freeze(struct device *dev)
{ {
...@@ -6611,11 +6609,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) ...@@ -6611,11 +6609,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 ctrl, ctrl_ext, rctl, status; u32 ctrl, ctrl_ext, rctl, status, wufc;
/* Runtime suspend should only enable wakeup for link changes */
u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol;
int retval = 0; int retval = 0;
/* Runtime suspend should only enable wakeup for link changes */
if (runtime)
wufc = E1000_WUFC_LNKC;
else if (device_may_wakeup(&pdev->dev))
wufc = adapter->wol;
else
wufc = 0;
status = er32(STATUS); status = er32(STATUS);
if (status & E1000_STATUS_LU) if (status & E1000_STATUS_LU)
wufc &= ~E1000_WUFC_LNKC; wufc &= ~E1000_WUFC_LNKC;
...@@ -6672,7 +6676,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) ...@@ -6672,7 +6676,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
if (adapter->hw.phy.type == e1000_phy_igp_3) { if (adapter->hw.phy.type == e1000_phy_igp_3) {
e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
} else if (hw->mac.type >= e1000_pch_lpt) { } else if (hw->mac.type >= e1000_pch_lpt) {
if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)))
/* ULP does not support wake from unicast, multicast /* ULP does not support wake from unicast, multicast
* or broadcast. * or broadcast.
*/ */
...@@ -6869,7 +6873,6 @@ static int e1000e_pm_thaw(struct device *dev) ...@@ -6869,7 +6873,6 @@ static int e1000e_pm_thaw(struct device *dev)
return rc; return rc;
} }
#ifdef CONFIG_PM
static int __e1000_resume(struct pci_dev *pdev) static int __e1000_resume(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
...@@ -6935,8 +6938,7 @@ static int __e1000_resume(struct pci_dev *pdev) ...@@ -6935,8 +6938,7 @@ static int __e1000_resume(struct pci_dev *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP static __maybe_unused int e1000e_pm_suspend(struct device *dev)
static int e1000e_pm_suspend(struct device *dev)
{ {
struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
...@@ -6960,7 +6962,7 @@ static int e1000e_pm_suspend(struct device *dev) ...@@ -6960,7 +6962,7 @@ static int e1000e_pm_suspend(struct device *dev)
return rc; return rc;
} }
static int e1000e_pm_resume(struct device *dev) static __maybe_unused int e1000e_pm_resume(struct device *dev)
{ {
struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
...@@ -6979,9 +6981,8 @@ static int e1000e_pm_resume(struct device *dev) ...@@ -6979,9 +6981,8 @@ static int e1000e_pm_resume(struct device *dev)
return e1000e_pm_thaw(dev); return e1000e_pm_thaw(dev);
} }
#endif /* CONFIG_PM_SLEEP */
static int e1000e_pm_runtime_idle(struct device *dev) static __maybe_unused int e1000e_pm_runtime_idle(struct device *dev)
{ {
struct net_device *netdev = dev_get_drvdata(dev); struct net_device *netdev = dev_get_drvdata(dev);
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
...@@ -6997,7 +6998,7 @@ static int e1000e_pm_runtime_idle(struct device *dev) ...@@ -6997,7 +6998,7 @@ static int e1000e_pm_runtime_idle(struct device *dev)
return -EBUSY; return -EBUSY;
} }
static int e1000e_pm_runtime_resume(struct device *dev) static __maybe_unused int e1000e_pm_runtime_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
...@@ -7014,7 +7015,7 @@ static int e1000e_pm_runtime_resume(struct device *dev) ...@@ -7014,7 +7015,7 @@ static int e1000e_pm_runtime_resume(struct device *dev)
return rc; return rc;
} }
static int e1000e_pm_runtime_suspend(struct device *dev) static __maybe_unused int e1000e_pm_runtime_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
...@@ -7039,7 +7040,6 @@ static int e1000e_pm_runtime_suspend(struct device *dev) ...@@ -7039,7 +7040,6 @@ static int e1000e_pm_runtime_suspend(struct device *dev)
return 0; return 0;
} }
#endif /* CONFIG_PM */
static void e1000_shutdown(struct pci_dev *pdev) static void e1000_shutdown(struct pci_dev *pdev)
{ {
......
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