TESTERS: if_sis patch

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Tue, 02 Sep 2003 11:44:52 +0200
Please try out this patch if you have a "sis" based network card.

It sets a 400usec interrupt holdoff, and this seems to have a profound
impact on network performance.

The patch is relative to FreeBSD-current but probably applies on
5.0, 5.1 and even 4.x as well.

In my tests, using a soekris 4801 computer I have found:

	fetch(1)'ing a ftp:// file from a server on the local segment
	is 43.2% +/-0.7% faster (from around 385 to 640 kBps).

	FTP of the same file is 10.6% +/-1.2% faster (from 3.11 to
	3.44 MB/sec)

	Checking out src/sbin from a NFS mounted CVSROOT was 17.0%
	+/-1.0% faster.

Poul-Henning

PS: I don't know why fetch(1) is so slow compared to ftp(1) ?


Index: if_sis.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_sis.c,v
retrieving revision 1.82
diff -u -r1.82 if_sis.c
--- if_sis.c	22 Aug 2003 07:13:21 -0000	1.82
+++ if_sis.c	2 Sep 2003 09:09:03 -0000
_at__at_ -107,7 +107,7 _at__at_
 static struct sis_type sis_devs[] = {
 	{ SIS_VENDORID, SIS_DEVICEID_900, "SiS 900 10/100BaseTX" },
 	{ SIS_VENDORID, SIS_DEVICEID_7016, "SiS 7016 10/100BaseTX" },
-	{ NS_VENDORID, NS_DEVICEID_DP83815, "NatSemi DP83815 10/100BaseTX" },
+	{ NS_VENDORID, NS_DEVICEID_DP83815, "NatSemi DP83815/6 10/100BaseTX" },
 	{ 0, 0, NULL }
 };
 
_at__at_ -2030,6 +2030,15 _at__at_
 	 * Cancel pending I/O and free all RX/TX buffers.
 	 */
 	sis_stop(sc);
+
+	if (sc->sis_type == SIS_TYPE_83815) {
+		/*
+		 * Hold off interrupts for 400usec.
+		 * This number is emperically found on a Soekris 4801
+		 */
+		printf("IHR=%x\n", CSR_READ_4(sc, NS_IHR));
+		CSR_WRITE_4(sc, NS_IHR, 0x100 | 4);
+	}
 
 	mii = device_get_softc(sc->sis_miibus);
 
Index: if_sisreg.h
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_sisreg.h,v
retrieving revision 1.22
diff -u -r1.22 if_sisreg.h
--- if_sisreg.h	22 Jul 2003 01:35:09 -0000	1.22
+++ if_sisreg.h	2 Sep 2003 09:09:03 -0000
_at__at_ -75,6 +75,7 _at__at_
 #define SIS_GPIO		0xB8
 
 /* NS DP83815 registers */
+#define NS_IHR			0x1C
 #define NS_CLKRUN		0x3C
 #define NS_BMCR			0x80
 #define NS_BMSR			0x84
-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Received on Tue Sep 02 2003 - 00:44:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC