diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2004-06-24 19:35:28 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2004-06-24 19:35:28 +0000 |
commit | c6cc17e855e1d9fe177fba41d00de6e89fdc852e (patch) | |
tree | bdc6bde04c820ca59fe49d60185cf6ac40b44e30 /sys/net/if_strip.c | |
parent | 128dd71ffeec48b94e085c757b3626553d619e7c (diff) |
This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.
It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code. Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.
ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@
Diffstat (limited to 'sys/net/if_strip.c')
-rw-r--r-- | sys/net/if_strip.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index c7f27a6d256..63a35580407 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_strip.c,v 1.29 2004/06/21 23:50:36 tholo Exp $ */ +/* $OpenBSD: if_strip.c,v 1.30 2004/06/24 19:35:25 tholo Exp $ */ /* $NetBSD: if_strip.c,v 1.2.4.3 1996/08/03 00:58:32 jtc Exp $ */ /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ @@ -834,10 +834,11 @@ stripoutput(ifp, m, dst, rt) s = splimp(); if (sc->sc_oqlen && sc->sc_ttyp->t_outq.c_cc == sc->sc_oqlen) { - struct timeval tv; + struct timeval tv, tm; /* if output's been stalled for too long, and restart */ - timersub(&time, &sc->sc_lastpacket, &tv); + getmicrotime(&tm); + timersub(&tm, &sc->sc_lastpacket, &tv); if (tv.tv_sec > 0) { DPRINTF(("stripoutput: stalled, resetting\n")); sc->sc_otimeout++; @@ -860,7 +861,7 @@ stripoutput(ifp, m, dst, rt) sc->sc_if.if_oerrors++; return (error); } - sc->sc_lastpacket = time; + getmicrotime(&sc->sc_lastpacket); if ((sc->sc_oqlen = sc->sc_ttyp->t_outq.c_cc) == 0) { stripstart(sc->sc_ttyp); } @@ -1002,7 +1003,7 @@ stripstart(tp) bpf_tap(sc->sc_bpf, cp, len + SLIP_HDRLEN); } #endif - sc->sc_lastpacket = time; + getmicrotime(&sc->sc_lastpacket); #if !(defined(__NetBSD__) || defined(__OpenBSD__)) /* XXX - cgd */ /* @@ -1260,7 +1261,7 @@ stripinput(c, tp) } sc->sc_if.if_ipackets++; - sc->sc_lastpacket = time; + getmicrotime(&sc->sc_lastpacket); s = splimp(); if (IF_QFULL(&ipintrq)) { IF_DROP(&ipintrq); @@ -1384,7 +1385,7 @@ strip_resetradio(sc, tp) * is so badlyhung it needs powercycling. */ sc->sc_state = ST_DEAD; - sc->sc_lastpacket = time; + getmicrotime(&sc->sc_lastpacket); sc->sc_statetimo = time_second + STRIP_RESET_INTERVAL; /* |