diff options
author | briggs <briggs@cvs.openbsd.org> | 1997-04-25 03:29:16 +0000 |
---|---|---|
committer | briggs <briggs@cvs.openbsd.org> | 1997-04-25 03:29:16 +0000 |
commit | 8a75bc7b41e91cc976a36a12871ac843109f52ac (patch) | |
tree | 3624ce5be6fe1d78f7f67e0ed3ee13f1a1cad27c /sys/arch/mac68k/dev/if_sn.c | |
parent | f92382202f6b017156ef0abbc7977fe8922301ca (diff) |
A couple of performance improvements from Denny Gentry <denny1@home.com>
Diffstat (limited to 'sys/arch/mac68k/dev/if_sn.c')
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index 3bd38797bf8..e65ad212d58 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,5 +1,5 @@ /* $NetBSD: if_sn.c,v 1.7 1997/03/20 17:47:51 scottr Exp $ */ -/* $OpenBSD: if_sn.c,v 1.21 1997/04/18 11:58:34 briggs Exp $ */ +/* $OpenBSD: if_sn.c,v 1.22 1997/04/25 03:29:15 briggs Exp $ */ /* * National Semiconductor SONIC Driver @@ -176,14 +176,6 @@ snsetup(sc) p = (unsigned char *)SOALIGN(sc, p); - for (i = 0; i < NRDA; i++) { - sc->p_rda[i] = (void *) p; - sc->v_rda[i] = kvtop(p); - p += RXPKT_SIZE(sc); - } - - p = (unsigned char *)SOALIGN(sc, p); - for (i = 0; i < NTDA; i++) { struct mtd *mtdp = &sc->mtda[i]; mtdp->mtd_txp = (void *)p; @@ -195,17 +187,34 @@ snsetup(sc) if ((p - pp) > NBPG) { printf ("%s: sizeof RRA (%ld) + CDA (%ld) +" - "RDA (%ld) + TDA (%ld) > NBPG (%d). Punt!\n", + "TDA (%ld) > NBPG (%d). Punt!\n", sc->sc_dev.dv_xname, (ulong)sc->p_cda - (ulong)sc->p_rra[0], - (ulong)sc->p_rda[0] - (ulong)sc->p_cda, - (ulong)sc->mtda[0].mtd_txp - (ulong)sc->p_rda[0], + (ulong)sc->mtda[0].mtd_txp - (ulong)sc->p_cda, (ulong)p - (ulong)sc->mtda[0].mtd_txp, NBPG); return(1); } p = pp + NBPG; + pp = p; + + if ((NRDA * RXPKT_SIZE(sc)) > NBPG) { + printf ("%s: sizeof NRDA (%d) > NBPG (%d). Punt!\n", + sc->sc_dev.dv_xname, + NRDA * RXPKT_SIZE(sc), NBPG); + return (1); + } + + for (i = 0; i < NRDA; i++) { + sc->p_rda[i] = (void *) p; + sc->v_rda[i] = kvtop(p); + p += RXPKT_SIZE(sc); + } + + p = (unsigned char *)SOALIGN(sc, p); + + p = pp + NBPG; for (i = 0; i < NRBA; i++) { sc->rbuf[i] = (caddr_t) p; |