From 483cc44070da1202b6dfdef9ca82972e449eafc7 Mon Sep 17 00:00:00 2001 From: Pyun YongHyeon Date: Mon, 8 Nov 2010 21:50:50 +0000 Subject: Follow the lead of vendor's interrupt moderation mechanism. It seems RTL8169/RTL8168/RTL810xE has a kind of interrupt moderation mechanism but it is not documented at all. The magic value dramatically reduced number of interrupts without noticeable performance drops so apply it to all RTL8169/RTL8169 controllers. Vendor's FreeBSD driver also applies it to RTL810xE controllers but their Linux driver explicitly cleared the register, so do not enable interrupt moderation for RTL810xE controllers. While I'm here sort 8169 specific registers. Obtained from: RealTek FreeBSD driver --- sys/dev/re/if_re.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sys/dev') diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 8f8cfa1b7727..0a2768ec9c17 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -2715,6 +2715,24 @@ re_init_locked(struct rl_softc *sc) */ re_set_rxmode(sc); + /* Configure interrupt moderation. */ + if (sc->rl_type == RL_8169) { + switch (sc->rl_hwrev) { + case RL_HWREV_8100E: + case RL_HWREV_8101E: + case RL_HWREV_8102E: + case RL_HWREV_8102EL: + case RL_HWREV_8102EL_SPIN1: + case RL_HWREV_8103E: + CSR_WRITE_2(sc, RL_INTRMOD, 0); + break; + default: + /* Magic from vendor. */ + CSR_WRITE_2(sc, RL_INTRMOD, 0x5151); + break; + } + } + #ifdef DEVICE_POLLING /* * Disable interrupts if we are polling. -- cgit v1.2.3