Skip to content

Commit

Permalink
r8169: disable ASPM during NAPI poll
Browse files Browse the repository at this point in the history
Several chip versions have problems with ASPM, what may result in
rx_missed errors or tx timeouts. The root cause isn't known but
experience shows that disabling ASPM during NAPI poll can avoid
these problems.

Suggested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Mar 8, 2023
1 parent 49ef7d8 commit e1ed3e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/net/ethernet/realtek/r8169_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4577,6 +4577,10 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
}

if (napi_schedule_prep(&tp->napi)) {
rtl_unlock_config_regs(tp);
rtl_hw_aspm_clkreq_enable(tp, false);
rtl_lock_config_regs(tp);

rtl_irq_disable(tp);
__napi_schedule(&tp->napi);
}
Expand Down Expand Up @@ -4636,9 +4640,14 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)

work_done = rtl_rx(dev, tp, budget);

if (work_done < budget && napi_complete_done(napi, work_done))
if (work_done < budget && napi_complete_done(napi, work_done)) {
rtl_irq_enable(tp);

rtl_unlock_config_regs(tp);
rtl_hw_aspm_clkreq_enable(tp, true);
rtl_lock_config_regs(tp);
}

return work_done;
}

Expand Down

0 comments on commit e1ed3e4

Please sign in to comment.