From c8aaabd573eb718845b3fa47027b70b24f02509b Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Mon, 10 Apr 1995 21:25:06 +0000 Subject: [PATCH] Performance enhancements and a redesign of the transmitter code. Submitted by: "Serge A. Babkin" --- sys/dev/ep/if_ep.c | 25 ++++++++++++++++++++++++- sys/dev/ep/if_epreg.h | 2 +- sys/i386/isa/if_ep.c | 25 ++++++++++++++++++++++++- sys/i386/isa/if_epreg.h | 2 +- 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 5096b87015b..68db808c5f1 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -38,7 +38,7 @@ */ /* - * March 28 1995 + * $Id: if_ep.c,v 1.13 1995/04/10 07:54:34 root Exp root $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -618,6 +618,16 @@ epinit(unit) } outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | sc->rx_early_thresh); + /* + * These clever computations look very interesting + * but the fixed threshold gives near no output errors + * and if it as low as 16 bytes it gives the max. throughput. + * We think that processor is anyway quicker than Ethernet + * (and this should be true for any 386 and higher) + */ + + outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16); + /* * Store up a bunch of mbuf's for use later. (MAX_MBS). First we free up * any that we had in case we're being called from intr or somewhere @@ -692,7 +702,15 @@ startagain: /* compute the Tx start threshold for this packet */ sc->tx_start_thresh = len = (((len * (64 - sc->tx_rate)) >> 6) & ~3) + 16; +#if 0 + /* + * The following string does something strange with the card and + * we get a lot of output errors due to it so it's commented out + * and we use fixed threshold (see above) + */ + outw(BASE + EP_COMMAND, SET_TX_START_THRESH | len); +#endif for (top = m; m != 0; m = m->m_next) if(ep_ftst(F_ACCESS_32_BITS)) { @@ -757,6 +775,9 @@ epintr(unit) register struct ep_softc *sc = &ep_softc[unit]; struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; + int x; + + x=splbio(); outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */ @@ -793,6 +814,7 @@ rescan: printf("ep%d: Status: %x\n", unit, status); #endif epinit(unit); + splx(x); return; } if (status & S_TX_COMPLETE) { @@ -846,6 +868,7 @@ rescan: /* re-enable Ints */ outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); + splx(x); } void diff --git a/sys/dev/ep/if_epreg.h b/sys/dev/ep/if_epreg.h index c91c7ac322c..a905caaaa34 100644 --- a/sys/dev/ep/if_epreg.h +++ b/sys/dev/ep/if_epreg.h @@ -31,7 +31,7 @@ */ /* - * March 28 1995 + * $Id: if_epreg.h,v 1.8 1995/04/10 07:48:03 root Exp root $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index 5096b87015b..68db808c5f1 100644 --- a/sys/i386/isa/if_ep.c +++ b/sys/i386/isa/if_ep.c @@ -38,7 +38,7 @@ */ /* - * March 28 1995 + * $Id: if_ep.c,v 1.13 1995/04/10 07:54:34 root Exp root $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -618,6 +618,16 @@ epinit(unit) } outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | sc->rx_early_thresh); + /* + * These clever computations look very interesting + * but the fixed threshold gives near no output errors + * and if it as low as 16 bytes it gives the max. throughput. + * We think that processor is anyway quicker than Ethernet + * (and this should be true for any 386 and higher) + */ + + outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16); + /* * Store up a bunch of mbuf's for use later. (MAX_MBS). First we free up * any that we had in case we're being called from intr or somewhere @@ -692,7 +702,15 @@ startagain: /* compute the Tx start threshold for this packet */ sc->tx_start_thresh = len = (((len * (64 - sc->tx_rate)) >> 6) & ~3) + 16; +#if 0 + /* + * The following string does something strange with the card and + * we get a lot of output errors due to it so it's commented out + * and we use fixed threshold (see above) + */ + outw(BASE + EP_COMMAND, SET_TX_START_THRESH | len); +#endif for (top = m; m != 0; m = m->m_next) if(ep_ftst(F_ACCESS_32_BITS)) { @@ -757,6 +775,9 @@ epintr(unit) register struct ep_softc *sc = &ep_softc[unit]; struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; + int x; + + x=splbio(); outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */ @@ -793,6 +814,7 @@ rescan: printf("ep%d: Status: %x\n", unit, status); #endif epinit(unit); + splx(x); return; } if (status & S_TX_COMPLETE) { @@ -846,6 +868,7 @@ rescan: /* re-enable Ints */ outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); + splx(x); } void diff --git a/sys/i386/isa/if_epreg.h b/sys/i386/isa/if_epreg.h index c91c7ac322c..a905caaaa34 100644 --- a/sys/i386/isa/if_epreg.h +++ b/sys/i386/isa/if_epreg.h @@ -31,7 +31,7 @@ */ /* - * March 28 1995 + * $Id: if_epreg.h,v 1.8 1995/04/10 07:48:03 root Exp root $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select