Skip to content

Commit cf2ffde

Browse files
hkallweitkuba-moo
authored andcommitted
r8169: revert 2ab19de ("r8169: remove ASPM restrictions now that ASPM is disabled during NAPI poll")
There have been reports that on a number of systems this change breaks network connectivity. Therefore effectively revert it. Mainly affected seem to be systems where BIOS denies ASPM access to OS. Due to later changes we can't do a direct revert. Fixes: 2ab19de ("r8169: remove ASPM restrictions now that ASPM is disabled during NAPI poll") Cc: [email protected] Link: https://lore.kernel.org/netdev/[email protected]/T/ Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217596 Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 81b3ade commit cf2ffde

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ struct rtl8169_private {
623623
int cfg9346_usage_count;
624624

625625
unsigned supports_gmii:1;
626+
unsigned aspm_manageable:1;
626627
dma_addr_t counters_phys_addr;
627628
struct rtl8169_counters *counters;
628629
struct rtl8169_tc_offsets tc_offset;
@@ -2746,7 +2747,8 @@ static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable)
27462747
if (tp->mac_version < RTL_GIGA_MAC_VER_32)
27472748
return;
27482749

2749-
if (enable) {
2750+
/* Don't enable ASPM in the chip if OS can't control ASPM */
2751+
if (enable && tp->aspm_manageable) {
27502752
/* On these chip versions ASPM can even harm
27512753
* bus communication of other PCI devices.
27522754
*/
@@ -5165,6 +5167,16 @@ static void rtl_init_mac_address(struct rtl8169_private *tp)
51655167
rtl_rar_set(tp, mac_addr);
51665168
}
51675169

5170+
/* register is set if system vendor successfully tested ASPM 1.2 */
5171+
static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
5172+
{
5173+
if (tp->mac_version >= RTL_GIGA_MAC_VER_61 &&
5174+
r8168_mac_ocp_read(tp, 0xc0b2) & 0xf)
5175+
return true;
5176+
5177+
return false;
5178+
}
5179+
51685180
static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
51695181
{
51705182
struct rtl8169_private *tp;
@@ -5234,6 +5246,19 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
52345246
xid);
52355247
tp->mac_version = chipset;
52365248

5249+
/* Disable ASPM L1 as that cause random device stop working
5250+
* problems as well as full system hangs for some PCIe devices users.
5251+
* Chips from RTL8168h partially have issues with L1.2, but seem
5252+
* to work fine with L1 and L1.1.
5253+
*/
5254+
if (rtl_aspm_is_safe(tp))
5255+
rc = 0;
5256+
else if (tp->mac_version >= RTL_GIGA_MAC_VER_46)
5257+
rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2);
5258+
else
5259+
rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1);
5260+
tp->aspm_manageable = !rc;
5261+
52375262
tp->dash_type = rtl_check_dash(tp);
52385263

52395264
tp->cp_cmd = RTL_R16(tp, CPlusCmd) & CPCMD_MASK;

0 commit comments

Comments
 (0)