mbox series

[SRU,OEM-B,PULL] Add Runtime D3 and ASPM support for r8169

Message ID 20180626145455.27547-1-kai.heng.feng@canonical.com
State New
Headers show
Series [SRU,OEM-B,PULL] Add Runtime D3 and ASPM support for r8169 | expand

Pull-request

git://git.launchpad.net/~kaihengfeng/+git/linux sru-oem-bionic-r8169-v4.18

Message

Kai-Heng Feng June 26, 2018, 2:54 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1757422

[Impact]
r8169 stays in D0 even when no ethernet cable is plugged in. This drains
lots of power (~3W). The tested laptop uses 5.5W when r8169 is in D0,
1.8W when r8169 is in D3. The power saved is substantial.

[Fix]
Improved rumtime PM logic to let the device gets suspended (D3) when the
port is not in used and the link is down.

Sync r8169 driver with linux-next. So in addition to D3, we have proper
ASPM support now.

All commits are cleanly cherry-picked.
This means the fix for LP: #1752772 is dropped and re-cherry-picked.

[Test Case]
The chip version is 8168h/8111h.
Test when no ethernet gets plugged.

Powertop shows power consumption is roughly 5.5W.
lspci shows the device is in D0.

With the patch,
The power consumption is reduced to 1.8W.
lspci shows the device is in D3, PME# is correctly enabled.
Plug ethernet cable can corretly wake up the device.
Unplug the cable, the device gets suspended to D3 correctly.

[Regression Potential]
Medium. The change set is massive although it's limited to r8169.
It should still be fine because OEM-B is the only user and we have QA as
our safety net.
The following changes since commit d856d692f38487da73f1055a77e16e19ebedc7bf:

  UBUNTU: Ubuntu-oem-4.15.0-1009.12 (2018-06-21 10:05:29 +0800)

are available in the Git repository at:

  git://git.launchpad.net/~kaihengfeng/+git/linux sru-oem-bionic-r8169-v4.18

for you to fetch changes up to 3dc0eec866f5194468b9ce946f0f5ed72b4121fc:

  r8169: don't check WoL when powering down PHY and interface is down (2018-06-26 22:36:52 +0800)

----------------------------------------------------------------
Andy Shevchenko (2):
      r8169: Dereference MMIO address immediately before use
      r8169: switch to device-managed functions in probe (part 2)

Heiner Kallweit (60):
      r8169: remove unneeded rpm ops in rtl_shutdown
      r8169: improve runtime pm in rtl8169_check_link_status
      r8169: improve runtime pm in general and suspend unused ports
      r8169: remove some WOL-related dead code
      r8169: remove not needed PHY soft reset in rtl8168e_2_hw_phy_config
      r8169: disable WOL per default
      r8169: simplify and improve check for dash
      r8169: improve interrupt handling
      r8169: convert remaining feature flag and remove enum features
      r8169: fix interrupt number after adding support for MSI-X interrupts
      r8169: simplify rtl_set_mac_address
      r8169: change type of first argument in rtl_tx_performance_tweak
      r8169: change type of argument in rtl_disable/enable_clock_request
      r8169: add helper tp_to_dev
      PCI: Add two more values for PCIe Max_Read_Request_Size
      r8169: replace magic numbers with PCI MRRS constant
      r8169: remove unused member features from struct
      r8169: remove member align from struct rtl_cfg_info
      r8169: use skb_copy_to_linear_data in rtl8169_try_rx_copy
      r8169: use constant NAPI_POLL_WAIT
      r8169: switch to napi_schedule_irqoff
      r8169: simplify rtl8169_alloc_rx_data
      r8169: improve rtl8169_init_ring
      r8169: remove unneeded check in rtl8169_rx_fill
      r8169: replace rx_buf_sz with a constant
      r8169: remove rtl8169_map_to_asic
      r8169: change hw_start argument type
      r8169: change argument type of counters handling functions
      r8169: change interrupt handler argument type
      r8169: drop member opts1_mask from struct rtl8169_private
      r8169: don't display tp->mmio_addr address
      r8169: improve rtl8169_get_mac_version
      r8169: drop member txd_version from struct rtl8169_private
      r8169: improve pci region handling
      r8169: remove jumbo_tx_csum from chip config struct
      r8169: don't use netif_info et al before net_device has been registered
      r8169: remove unneeded call to __rtl8169_set_features in rtl_open
      r8169: improve rtl8169_set_features
      r8169: replace magic number for INTT mask with a constant
      r8169: improve CPlusCmd handling
      r8169: improve handling of CPCMD quirk mask
      r8169: simplify rtl_hw_start_8169
      r8169: remove calls to rtl_set_rx_mode
      r8169: move common initializations to tp->hw_start
      r8169: remove unneeded check in r8168_pll_power_down
      r8169: remove 810x_phy_power_up/down
      r8169: merge r810x_pll_power_down/up into r8168_pll_power_down/up
      r8169: drop member pll_power_ops from struct rtl8169_private
      r8169: simplify code by using ranges in switch clauses
      r8169: replace longer if statements with switch statements
      r8169: drop rtl_generic_op
      r8169: improve PCI config space access
      r8169: avoid potentially misaligned access when getting mac address
      r8169: replace get_protocol with vlan_get_protocol
      r8169: fix network error on resume from suspend
      r8169: align ASPM entry latency setting with vendor driver
      r8169: enable ASPM on RTL8168E-VL
      r8169: improve phy initialization when resuming
      r8169: improve saved_wolopts handling
      r8169: don't check WoL when powering down PHY and interface is down

Kai-Heng Feng (6):
      Revert "r8169: fix interrupt number after adding support for MSI-X interrupts"
      Revert "r8169: improve interrupt handling"
      Revert "r8169: disable WOL per default"
      Revert "r8169: remove some WOL-related dead code"
      r8169: Don't disable ASPM in the driver
      r8169: Reinstate ASPM Support

Ville Syrjälä (1):
      r8169: Fix netpoll oops

 drivers/net/ethernet/realtek/r8169.c | 2195 +++++++++++-----------------------
 include/uapi/linux/pci_regs.h        |    2 +
 2 files changed, 694 insertions(+), 1503 deletions(-)

Comments

Timo Aaltonen July 5, 2018, 9:51 a.m. UTC | #1
On 26.06.2018 17:54, Kai-Heng Feng wrote:
> BugLink: https://bugs.launchpad.net/bugs/1757422
> 
> [Impact]
> r8169 stays in D0 even when no ethernet cable is plugged in. This drains
> lots of power (~3W). The tested laptop uses 5.5W when r8169 is in D0,
> 1.8W when r8169 is in D3. The power saved is substantial.
> 
> [Fix]
> Improved rumtime PM logic to let the device gets suspended (D3) when the
> port is not in used and the link is down.
> 
> Sync r8169 driver with linux-next. So in addition to D3, we have proper
> ASPM support now.
> 
> All commits are cleanly cherry-picked.
> This means the fix for LP: #1752772 is dropped and re-cherry-picked.
> 
> [Test Case]
> The chip version is 8168h/8111h.
> Test when no ethernet gets plugged.
> 
> Powertop shows power consumption is roughly 5.5W.
> lspci shows the device is in D0.
> 
> With the patch,
> The power consumption is reduced to 1.8W.
> lspci shows the device is in D3, PME# is correctly enabled.
> Plug ethernet cable can corretly wake up the device.
> Unplug the cable, the device gets suspended to D3 correctly.
> 
> [Regression Potential]
> Medium. The change set is massive although it's limited to r8169.
> It should still be fine because OEM-B is the only user and we have QA as
> our safety net.


So, since we don't know yet which kernel will eventually replace 4.15
based OEM-B kernel, and since upgrades from xenial oem -> bionic
backport need a DKMS anyway, we've decided that this backport won't get
applied to OEM-B. Applying it to OEM-B would essentially mean that users
could not be migrated to bionic master, because this backport is too big
for it.