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>
This commit is contained in:
Peter Wemm 1999-08-19 15:07:20 +00:00
parent 264c3d8738
commit e9fc0b372f
2 changed files with 4 additions and 22 deletions

View File

@ -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(

View File

@ -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(