mbox series

[v8,RESEND,0/6] r8169: Enable ASPM for recent 1.0/2.5Gbps Realtek NICs

Message ID 20230221023849.1906728-1-kai.heng.feng@canonical.com
Headers show
Series r8169: Enable ASPM for recent 1.0/2.5Gbps Realtek NICs | expand

Message

Kai-Heng Feng Feb. 21, 2023, 2:38 a.m. UTC
The series is to enable ASPM on more r8169 supported devices, if
available.

The latest Realtek vendor driver and its Windows driver implements a
feature called "dynamic ASPM" which can improve performance on it's
ethernet NICs.

We have "dynamic ASPM" mechanism in Ubuntu 22.04 LTS kernel for quite a
while, and AFAIK it hasn't introduced any regression so far. 

A very similar issue was observed on Realtek wireless NIC, and it was
resolved by disabling ASPM during NAPI poll. So in v8, we use the same
approach, which is more straightforward, instead of toggling ASPM based
on packet count.

v7:
https://lore.kernel.org/netdev/20211016075442.650311-1-kai.heng.feng@canonical.com/

v6:
https://lore.kernel.org/netdev/20211007161552.272771-1-kai.heng.feng@canonical.com/

v5:
https://lore.kernel.org/netdev/20210916154417.664323-1-kai.heng.feng@canonical.com/

v4:
https://lore.kernel.org/netdev/20210827171452.217123-1-kai.heng.feng@canonical.com/

v3:
https://lore.kernel.org/netdev/20210819054542.608745-1-kai.heng.feng@canonical.com/

v2:
https://lore.kernel.org/netdev/20210812155341.817031-1-kai.heng.feng@canonical.com/

v1:
https://lore.kernel.org/netdev/20210803152823.515849-1-kai.heng.feng@canonical.com/

Kai-Heng Feng (6):
  r8169: Disable ASPM L1.1 on 8168h
  Revert "PCI/ASPM: Unexport pcie_aspm_support_enabled()"
  PCI/ASPM: Add pcie_aspm_capable() helper
  r8169: Consider chip-specific ASPM can be enabled on more cases
  r8169: Use mutex to guard config register locking
  r8169: Disable ASPM while doing NAPI poll

 drivers/net/ethernet/realtek/r8169_main.c | 48 ++++++++++++++++++-----
 drivers/pci/pcie/aspm.c                   | 12 ++++++
 include/linux/pci.h                       |  2 +
 3 files changed, 53 insertions(+), 9 deletions(-)

Comments

Heiner Kallweit Feb. 21, 2023, 10:48 a.m. UTC | #1
On 21.02.2023 03:38, Kai-Heng Feng wrote:
> The series is to enable ASPM on more r8169 supported devices, if
> available.
> 
> The latest Realtek vendor driver and its Windows driver implements a
> feature called "dynamic ASPM" which can improve performance on it's
> ethernet NICs.
> 
> We have "dynamic ASPM" mechanism in Ubuntu 22.04 LTS kernel for quite a
> while, and AFAIK it hasn't introduced any regression so far. 
> 
> A very similar issue was observed on Realtek wireless NIC, and it was
> resolved by disabling ASPM during NAPI poll. So in v8, we use the same
> approach, which is more straightforward, instead of toggling ASPM based
> on packet count.
> 
> v7:
> https://lore.kernel.org/netdev/20211016075442.650311-1-kai.heng.feng@canonical.com/
> 
> v6:
> https://lore.kernel.org/netdev/20211007161552.272771-1-kai.heng.feng@canonical.com/
> 
> v5:
> https://lore.kernel.org/netdev/20210916154417.664323-1-kai.heng.feng@canonical.com/
> 
> v4:
> https://lore.kernel.org/netdev/20210827171452.217123-1-kai.heng.feng@canonical.com/
> 
> v3:
> https://lore.kernel.org/netdev/20210819054542.608745-1-kai.heng.feng@canonical.com/
> 
> v2:
> https://lore.kernel.org/netdev/20210812155341.817031-1-kai.heng.feng@canonical.com/
> 
> v1:
> https://lore.kernel.org/netdev/20210803152823.515849-1-kai.heng.feng@canonical.com/
> 
> Kai-Heng Feng (6):
>   r8169: Disable ASPM L1.1 on 8168h
>   Revert "PCI/ASPM: Unexport pcie_aspm_support_enabled()"
>   PCI/ASPM: Add pcie_aspm_capable() helper
>   r8169: Consider chip-specific ASPM can be enabled on more cases
>   r8169: Use mutex to guard config register locking
>   r8169: Disable ASPM while doing NAPI poll
> 
>  drivers/net/ethernet/realtek/r8169_main.c | 48 ++++++++++++++++++-----
>  drivers/pci/pcie/aspm.c                   | 12 ++++++
>  include/linux/pci.h                       |  2 +
>  3 files changed, 53 insertions(+), 9 deletions(-)
> 

Note that net-next is closed during merge window.
Formal aspect: Your patches miss the net/net-next annotation.
The title of the series may be an old one. Actually most ASPM
states are enabled, you add to disable ASPM temporarily.
Kai-Heng Feng Feb. 22, 2023, 12:58 p.m. UTC | #2
On Tue, Feb 21, 2023 at 7:09 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On 21.02.2023 03:38, Kai-Heng Feng wrote:
> > The series is to enable ASPM on more r8169 supported devices, if
> > available.
> >
> > The latest Realtek vendor driver and its Windows driver implements a
> > feature called "dynamic ASPM" which can improve performance on it's
> > ethernet NICs.
> >
> > We have "dynamic ASPM" mechanism in Ubuntu 22.04 LTS kernel for quite a
> > while, and AFAIK it hasn't introduced any regression so far.
> >
> > A very similar issue was observed on Realtek wireless NIC, and it was
> > resolved by disabling ASPM during NAPI poll. So in v8, we use the same
> > approach, which is more straightforward, instead of toggling ASPM based
> > on packet count.
> >
> > v7:
> > https://lore.kernel.org/netdev/20211016075442.650311-1-kai.heng.feng@canonical.com/
> >
> > v6:
> > https://lore.kernel.org/netdev/20211007161552.272771-1-kai.heng.feng@canonical.com/
> >
> > v5:
> > https://lore.kernel.org/netdev/20210916154417.664323-1-kai.heng.feng@canonical.com/
> >
> > v4:
> > https://lore.kernel.org/netdev/20210827171452.217123-1-kai.heng.feng@canonical.com/
> >
> > v3:
> > https://lore.kernel.org/netdev/20210819054542.608745-1-kai.heng.feng@canonical.com/
> >
> > v2:
> > https://lore.kernel.org/netdev/20210812155341.817031-1-kai.heng.feng@canonical.com/
> >
> > v1:
> > https://lore.kernel.org/netdev/20210803152823.515849-1-kai.heng.feng@canonical.com/
> >
> > Kai-Heng Feng (6):
> >   r8169: Disable ASPM L1.1 on 8168h
> >   Revert "PCI/ASPM: Unexport pcie_aspm_support_enabled()"
> >   PCI/ASPM: Add pcie_aspm_capable() helper
> >   r8169: Consider chip-specific ASPM can be enabled on more cases
> >   r8169: Use mutex to guard config register locking
> >   r8169: Disable ASPM while doing NAPI poll
> >
> >  drivers/net/ethernet/realtek/r8169_main.c | 48 ++++++++++++++++++-----
> >  drivers/pci/pcie/aspm.c                   | 12 ++++++
> >  include/linux/pci.h                       |  2 +
> >  3 files changed, 53 insertions(+), 9 deletions(-)
> >
>
> Note that net-next is closed during merge window.
> Formal aspect: Your patches miss the net/net-next annotation.

Will do in next revision.

> The title of the series may be an old one. Actually most ASPM
> states are enabled, you add to disable ASPM temporarily.

Right.
Most hardwares I have access to don't grant OS ASPM control, so
tp->aspm_manageable is not enabled.
Will make it more clearer.

Kai-Heng