Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Nov 2010 21:50:50 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215017 - in head/sys: dev/re pci
Message-ID:  <201011082150.oA8LooED055912@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Mon Nov  8 21:50:50 2010
New Revision: 215017
URL: http://svn.freebsd.org/changeset/base/215017

Log:
  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

Modified:
  head/sys/dev/re/if_re.c
  head/sys/pci/if_rlreg.h

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Mon Nov  8 21:50:45 2010	(r215016)
+++ head/sys/dev/re/if_re.c	Mon Nov  8 21:50:50 2010	(r215017)
@@ -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.

Modified: head/sys/pci/if_rlreg.h
==============================================================================
--- head/sys/pci/if_rlreg.h	Mon Nov  8 21:50:45 2010	(r215016)
+++ head/sys/pci/if_rlreg.h	Mon Nov  8 21:50:50 2010	(r215017)
@@ -125,6 +125,7 @@
 /*
  * Registers specific to the 8169 gigE chip
  */
+#define RL_GTXSTART		0x0038	/* 8 bits */
 #define RL_TIMERINT_8169	0x0058	/* different offset than 8139 */
 #define RL_PHYAR		0x0060
 #define RL_TBICSR		0x0064
@@ -135,7 +136,7 @@
 #define RL_GPIO			0x006E	/* 8 bits, 8168C SPIN2 only */
 #define RL_PMCH			0x006F	/* 8 bits */
 #define RL_MAXRXPKTLEN		0x00DA	/* 16 bits, chip multiplies by 8 */
-#define RL_GTXSTART		0x0038	/* 8 bits */
+#define RL_INTRMOD		0x00E2	/* 16 bits */
 
 /*
  * TX config register bits



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011082150.oA8LooED055912>