From 88eaaf7a8a6887e6b2f1e68c707e727d32e8ebd1 Mon Sep 17 00:00:00 2001 From: ferrreo Date: Thu, 20 Jul 2023 14:25:47 +0100 Subject: [PATCH] 6.4.3 - fix r8169 --- patches/0006-r8169-fix.patch | 81 ++++++++++++++++++++++++++++++++++++ scripts/build.sh | 2 +- scripts/patch.sh | 2 + 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 patches/0006-r8169-fix.patch diff --git a/patches/0006-r8169-fix.patch b/patches/0006-r8169-fix.patch new file mode 100644 index 0000000..a1c77a8 --- /dev/null +++ b/patches/0006-r8169-fix.patch @@ -0,0 +1,81 @@ +From 2ab19de62d67e403105ba860971e5ff0d511ad15 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 6 Mar 2023 22:28:06 +0100 +Subject: [PATCH] r8169: remove ASPM restrictions now that ASPM is disabled + during NAPI poll +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Now that ASPM is disabled during NAPI poll, we can remove all ASPM +restrictions. This allows for higher power savings if the network +isn't fully loaded. + +Reviewed-by: Simon Horman +Tested-by: Kai-Heng Feng +Tested-by: Holger Hoffstätte +Signed-off-by: Heiner Kallweit +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/realtek/r8169_main.c | 27 +---------------------- + 1 file changed, 1 insertion(+), 26 deletions(-) + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index 2897b9bf29af67..6563e4c6a13606 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -620,7 +620,6 @@ struct rtl8169_private { + int cfg9346_usage_count; + + unsigned supports_gmii:1; +- unsigned aspm_manageable:1; + dma_addr_t counters_phys_addr; + struct rtl8169_counters *counters; + struct rtl8169_tc_offsets tc_offset; +@@ -2744,8 +2743,7 @@ static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable) + if (tp->mac_version < RTL_GIGA_MAC_VER_32) + return; + +- /* Don't enable ASPM in the chip if OS can't control ASPM */ +- if (enable && tp->aspm_manageable) { ++ if (enable) { + rtl_mod_config5(tp, 0, ASPM_en); + rtl_mod_config2(tp, 0, ClkReqEn); + +@@ -5221,16 +5219,6 @@ static void rtl_init_mac_address(struct rtl8169_private *tp) + rtl_rar_set(tp, mac_addr); + } + +-/* register is set if system vendor successfully tested ASPM 1.2 */ +-static bool rtl_aspm_is_safe(struct rtl8169_private *tp) +-{ +- if (tp->mac_version >= RTL_GIGA_MAC_VER_61 && +- r8168_mac_ocp_read(tp, 0xc0b2) & 0xf) +- return true; +- +- return false; +-} +- + static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + { + struct rtl8169_private *tp; +@@ -5302,19 +5290,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + + tp->mac_version = chipset; + +- /* Disable ASPM L1 as that cause random device stop working +- * problems as well as full system hangs for some PCIe devices users. +- * Chips from RTL8168h partially have issues with L1.2, but seem +- * to work fine with L1 and L1.1. +- */ +- if (rtl_aspm_is_safe(tp)) +- rc = 0; +- else if (tp->mac_version >= RTL_GIGA_MAC_VER_46) +- rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2); +- else +- rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1); +- tp->aspm_manageable = !rc; +- + tp->dash_type = rtl_check_dash(tp); + + tp->cp_cmd = RTL_R16(tp, CPlusCmd) & CPCMD_MASK; \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 643350c..9a08f96 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,4 +2,4 @@ echo "Pika Kernel - Building" -make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos KDEB_PKGVERSION=$(make kernelversion)-23 +make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos KDEB_PKGVERSION=$(make kernelversion)-24 diff --git a/scripts/patch.sh b/scripts/patch.sh index bc45e8b..0b223dc 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -16,3 +16,5 @@ patch -Np1 < "../patches/0002-eevdfbore.patch" patch -Np1 < "../patches/0004-Allow-to-set-custom-USB-pollrate-for-specific-device.patch" # Allow pre polaris cards to use the amdgpu kernel module patch -Np1 < "../patches/0005-amdgpu-si-cik-default.patch" +# Fix a dumb upstream change that breaks the r8169 ethernet adapter +patch -RNp1 < "../patches/0006-r8169-fix.patch" \ No newline at end of file