aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1999-08-19 15:07:20 +0000
committerPeter Wemm <peter@FreeBSD.org>1999-08-19 15:07:20 +0000
commite9fc0b372f5ad56e1d1c08df2e1a0e0d4d157b20 (patch)
tree866ef366edf9c4729f788cf6688b28d03fc52508
parent264c3d8738c3580b596ecf5aaa1ce1b5367fc0da (diff)
downloadsrc-e9fc0b372f5ad56e1d1c08df2e1a0e0d4d157b20.tar.gz
src-e9fc0b372f5ad56e1d1c08df2e1a0e0d4d157b20.zip
Replace the tulip_delay_300ns() with a DELAY(1). Hammering the PCI bus
to achieve a delay is pretty mean. Andrew reports: "The tulip_delay_300ns() is, well, bloody stupid on machines with a heavily loaded PCI bus. It tries to do a delay by assuming PCI reads will take a certain amount of time & issues a large amount of (expensive, 5% CPU when your PCI bus is heavily loaded) pci reads. Locally, we've replaced the calls to tulip_delay_300ns(sc) in the EMIT macros with a simple DELAY(1) and not seen any problems. Plus we've gained about 50Mb/sec throughput on our gigabit network cards because of the added PCI bus bandwidth available." Also, I do not understand why, but this change appears to stop the Transmit Fifo underrun on one of my systems (but not the Alpha PC164SX). This shouldn't make that much of a difference since the mii bus isn't touched all that often, but perhaps when it does get accessed and hence hammers the register, it was causing the chip to get upset. Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>
Notes
Notes: svn path=/head/; revision=50055
-rw-r--r--sys/dev/de/if_de.c13
-rw-r--r--sys/pci/if_de.c13
2 files changed, 4 insertions, 22 deletions
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
index e0e9d55b11d2..c1a290f32706 100644
--- a/sys/dev/de/if_de.c
+++ b/sys/dev/de/if_de.c
@@ -1820,16 +1820,7 @@ static const tulip_boardsw_t tulip_2114x_isv_boardsw = {
/*
* Code the read the SROM and MII bit streams (I2C)
*/
-static void
-tulip_delay_300ns(
- tulip_softc_t * const sc)
-{
- int idx;
- for (idx = (300 / 33) + 1; idx > 0; idx--)
- (void) TULIP_CSR_READ(sc, csr_busmode);
-}
-
-#define EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); tulip_delay_300ns(sc); } while (0)
+#define EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0)
static void
tulip_srom_idle(
@@ -1902,7 +1893,7 @@ tulip_srom_read(
tulip_srom_idle(sc);
}
-#define MII_EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); tulip_delay_300ns(sc); } while (0)
+#define MII_EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0)
static void
tulip_mii_writebits(
diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c
index e0e9d55b11d2..c1a290f32706 100644
--- a/sys/pci/if_de.c
+++ b/sys/pci/if_de.c
@@ -1820,16 +1820,7 @@ static const tulip_boardsw_t tulip_2114x_isv_boardsw = {
/*
* Code the read the SROM and MII bit streams (I2C)
*/
-static void
-tulip_delay_300ns(
- tulip_softc_t * const sc)
-{
- int idx;
- for (idx = (300 / 33) + 1; idx > 0; idx--)
- (void) TULIP_CSR_READ(sc, csr_busmode);
-}
-
-#define EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); tulip_delay_300ns(sc); } while (0)
+#define EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0)
static void
tulip_srom_idle(
@@ -1902,7 +1893,7 @@ tulip_srom_read(
tulip_srom_idle(sc);
}
-#define MII_EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); tulip_delay_300ns(sc); } while (0)
+#define MII_EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0)
static void
tulip_mii_writebits(