diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2001-08-25 13:33:38 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2001-08-25 13:33:38 +0000 |
commit | 2f9f539a801e8c00430eacc3a70495465ca02e4e (patch) | |
tree | a8c95a4e7bd59da4baa2c4974425216c11ff94b4 /sys/arch/vax/if | |
parent | 1195029145310bb1c26d5da6e89f13372126bc9b (diff) |
Bring in some useful stuff from NetBSD. Mostly work by Matt Thomas,
and concerned with intvec counting. Also some ANSIfication.
Diffstat (limited to 'sys/arch/vax/if')
-rw-r--r-- | sys/arch/vax/if/if_le.c | 7 | ||||
-rw-r--r-- | sys/arch/vax/if/if_ze.c | 5 | ||||
-rw-r--r-- | sys/arch/vax/if/sgec.c | 25 | ||||
-rw-r--r-- | sys/arch/vax/if/sgecvar.h | 5 |
4 files changed, 28 insertions, 14 deletions
diff --git a/sys/arch/vax/if/if_le.c b/sys/arch/vax/if/if_le.c index f370c74eb64..f37a00d2f6e 100644 --- a/sys/arch/vax/if/if_le.c +++ b/sys/arch/vax/if/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.5 2000/04/27 03:14:43 bjc Exp $ */ +/* $OpenBSD: if_le.c,v 1.6 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: if_le.c,v 1.14 1999/08/14 18:40:23 ragge Exp $ */ /*- @@ -108,6 +108,7 @@ struct le_softc { struct am7990_softc sc_am7990; /* Must be first */ + struct evcnt sc_intrcnt; volatile u_short *sc_rap; volatile u_short *sc_rdp; }; @@ -184,7 +185,9 @@ le_ibus_attach(parent, self, aux) i = scb_vecref(&vec, &br); if (i == 0 || vec == 0) return; - scb_vecalloc(vec, (void *)am7990_intr, sc, SCB_ISTACK); + scb_vecalloc(vec, (void *)am7990_intr, sc, + SCB_ISTACK, &sc->sc_intrcnt); + evcnt_attach(self, "intr", &sc->sc_intrcnt); printf(": vec %o ipl %x\n%s", vec, br, self->dv_xname); /* diff --git a/sys/arch/vax/if/if_ze.c b/sys/arch/vax/if/if_ze.c index 9421b1d786f..6853271ccdd 100644 --- a/sys/arch/vax/if/if_ze.c +++ b/sys/arch/vax/if/if_ze.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ze.c,v 1.2 2001/05/20 14:19:43 hugh Exp $ */ +/* $OpenBSD: if_ze.c,v 1.3 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: if_ze.c,v 1.3 2000/01/24 02:54:03 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -127,7 +127,8 @@ zeattach(parent, self, aux) vax_unmap_physmem((vaddr_t)ea, 1); - scb_vecalloc(SGECVEC, (void (*)(void *)) sgec_intr, sc, SCB_ISTACK); + scb_vecalloc(SGECVEC, (void (*)(void *)) sgec_intr, sc, + SCB_ISTACK, &sc->sc_intrcnt); sgec_attach(sc); } diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index 0352be31789..7259a99acd5 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sgec.c,v 1.2 2001/02/20 19:39:35 mickey Exp $ */ -/* $NetBSD: sgec.c,v 1.1 1999/08/08 11:41:29 ragge Exp $ */ +/* $OpenBSD: sgec.c,v 1.3 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. * @@ -173,6 +173,10 @@ sgec_attach(sc) } } + /* For vmstat -i + */ + evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt); + /* * Create ring loops of the buffer chains. * This is only done once. @@ -306,6 +310,7 @@ zestart(ifp) paddr_t buffer; struct mbuf *m, *m0; int idx, len, s, i, totlen, error; + int old_inq = sc->sc_inq; short orword; s = splimp(); @@ -388,7 +393,7 @@ zestart(ifp) if (sc->sc_inq == (TXDESCS - 1)) ifp->if_flags |= IFF_OACTIVE; -out: if (sc->sc_inq) +out: if (old_inq < sc->sc_inq) ifp->if_timer = 5; /* If transmit logic dies */ splx(s); } @@ -412,6 +417,7 @@ sgec_intr(sc) while ((zc->zc_recv[sc->sc_nextrx].ze_framelen & ZE_FRAMELEN_OW) == 0) { + ifp->if_ipackets++; m = sc->sc_rxmbuf[sc->sc_nextrx]; len = zc->zc_recv[sc->sc_nextrx].ze_framelen; ze_add_rxbuf(sc, sc->sc_nextrx); @@ -424,9 +430,9 @@ sgec_intr(sc) if (ifp->if_bpf) { bpf_mtap(ifp->if_bpf, m); if ((ifp->if_flags & IFF_PROMISC) != 0 && + ((eh->ether_dhost[0] & 1) == 0) && bcmp(sc->sc_ac.ac_enaddr, eh->ether_dhost, - ETHER_ADDR_LEN) != 0 && - ((eh->ether_dhost[0] & 1) == 0)) { + ETHER_ADDR_LEN) != 0) { m_freem(m); continue; } @@ -458,17 +464,20 @@ sgec_intr(sc) if (++sc->sc_lastack == TXDESCS) sc->sc_lastack = 0; - /* XXX collect statistics */ if ((zc->zc_xmit[idx].ze_tdes1 & ZE_TDES1_DT) == ZE_TDES1_DT_SETUP) continue; + /* XXX collect statistics */ + if (zc->zc_xmit[idx].ze_tdes1 & ZE_TDES1_LS) + ifp->if_opackets++; bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[idx]); if (sc->sc_txmbuf[idx]) { m_freem(sc->sc_txmbuf[idx]); sc->sc_txmbuf[idx] = 0; } } - ifp->if_timer = 0; + if (sc->sc_inq == 0) + ifp->if_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; zestart(ifp); /* Put in more in queue */ } @@ -480,7 +489,7 @@ sgec_intr(sc) */ int zeioctl(ifp, cmd, data) - register struct ifnet *ifp; + struct ifnet *ifp; u_long cmd; caddr_t data; { diff --git a/sys/arch/vax/if/sgecvar.h b/sys/arch/vax/if/sgecvar.h index 7cf93770817..fdee7fa4a43 100644 --- a/sys/arch/vax/if/sgecvar.h +++ b/sys/arch/vax/if/sgecvar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: sgecvar.h,v 1.1 2000/04/27 03:14:44 bjc Exp $ */ -/* $NetBSD: sgecvar.h,v 1.1 1999/08/08 11:41:30 ragge Exp $ */ +/* $OpenBSD: sgecvar.h,v 1.2 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: sgecvar.h,v 1.2 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. * @@ -44,6 +44,7 @@ struct ze_cdata { struct ze_softc { struct device sc_dev; /* Configuration common part */ + struct evcnt sc_intrcnt; /* Interrupt counters */ struct arpcom sc_ac; /* Ethernet common part */ #define sc_if sc_ac.ac_if /* network-visible interface */ bus_space_tag_t sc_iot; |