diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_pppvar.h | 3 | ||||
-rw-r--r-- | sys/net/if_sl.c | 30 | ||||
-rw-r--r-- | sys/net/if_slvar.h | 12 | ||||
-rw-r--r-- | sys/net/if_sppp.h | 3 | ||||
-rw-r--r-- | sys/net/if_spppsubr.c | 24 | ||||
-rw-r--r-- | sys/net/ppp_tty.c | 6 |
6 files changed, 49 insertions, 29 deletions
diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h index 41f9050..67a9d7b 100644 --- a/sys/net/if_pppvar.h +++ b/sys/net/if_pppvar.h @@ -39,7 +39,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id$ + * $Id: if_pppvar.h,v 1.8 1997/08/19 14:10:45 peter Exp $ */ /* @@ -55,6 +55,7 @@ struct ppp_softc { struct ifnet sc_if; /* network-visible interface */ /*hi*/ u_int sc_flags; /* control/status bits; see if_ppp.h */ + struct callout_handle sc_ch; /* Used for scheduling timeouts */ void *sc_devp; /* pointer to device-dep structure */ void (*sc_start) __P((struct ppp_softc *)); /* start output proc */ void (*sc_ctlp) __P((struct ppp_softc *)); /* rcvd control pkt */ diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 7d2f176..08cea82 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_sl.c 8.6 (Berkeley) 2/1/94 - * $Id: if_sl.c,v 1.58 1997/08/02 14:32:39 bde Exp $ + * $Id: if_sl.c,v 1.59 1997/08/13 14:57:14 ache Exp $ */ /* @@ -332,11 +332,11 @@ slclose(tp,flag) if (sc != NULL) { if (sc->sc_outfill) { sc->sc_outfill = 0; - untimeout(sl_outfill, sc); + untimeout(sl_outfill, sc, sc->sc_ofhandle); } if (sc->sc_keepalive) { sc->sc_keepalive = 0; - untimeout(sl_keepalive, sc); + untimeout(sl_keepalive, sc, sc->sc_kahandle); } if_down(&sc->sc_if); sc->sc_flags &= SC_STATIC; @@ -408,10 +408,13 @@ sltioctl(tp, cmd, data, flag, p) sc->sc_keepalive = *(u_int *)data * hz; if (sc->sc_keepalive) { sc->sc_flags |= SC_KEEPALIVE; - timeout(sl_keepalive, sc, sc->sc_keepalive); + sc->sc_kahandle = timeout(sl_keepalive, sc, + sc->sc_keepalive); } else { - sc->sc_flags &= ~SC_KEEPALIVE; - untimeout(sl_keepalive, sc); + if ((sc->sc_flags & SC_KEEPALIVE) != 0) { + untimeout(sl_keepalive, sc, sc->sc_kahandle); + sc->sc_flags &= ~SC_KEEPALIVE; + } } break; @@ -423,10 +426,13 @@ sltioctl(tp, cmd, data, flag, p) sc->sc_outfill = *(u_int *)data * hz; if (sc->sc_outfill) { sc->sc_flags |= SC_OUTWAIT; - timeout(sl_outfill, sc, sc->sc_outfill); + sc->sc_ofhandle = timeout(sl_outfill, sc, + sc->sc_outfill); } else { - sc->sc_flags &= ~SC_OUTWAIT; - untimeout(sl_outfill, sc); + if ((sc->sc_flags & SC_OUTWAIT) != 0) { + untimeout(sl_outfill, sc, sc->sc_ofhandle); + sc->sc_flags &= ~SC_OUTWAIT; + } } break; @@ -1005,10 +1011,9 @@ sl_keepalive(chan) pgsignal (sc->sc_ttyp->t_pgrp, SIGURG, 1); else sc->sc_flags |= SC_KEEPALIVE; - timeout(sl_keepalive, sc, sc->sc_keepalive); + sc->sc_kahandle = timeout(sl_keepalive, sc, sc->sc_keepalive); } else { sc->sc_flags &= ~SC_KEEPALIVE; - untimeout(sl_keepalive, sc); } } @@ -1029,10 +1034,9 @@ sl_outfill(chan) splx (s); } else sc->sc_flags |= SC_OUTWAIT; - timeout(sl_outfill, sc, sc->sc_outfill); + sc->sc_ofhandle = timeout(sl_outfill, sc, sc->sc_outfill); } else { sc->sc_flags &= ~SC_OUTWAIT; - untimeout(sl_outfill, sc); } } diff --git a/sys/net/if_slvar.h b/sys/net/if_slvar.h index 1621c97..b19bd26 100644 --- a/sys/net/if_slvar.h +++ b/sys/net/if_slvar.h @@ -32,12 +32,14 @@ * * @(#)if_slvar.h 8.3 (Berkeley) 2/1/94 * - * $Id$ + * $Id: if_slvar.h,v 1.13 1997/02/22 09:41:06 peter Exp $ */ #ifndef _NET_IF_SLVAR_H_ #define _NET_IF_SLVAR_H_ +#include <sys/callout.h> + /* * Definitions for SLIP interface data structures * @@ -57,7 +59,13 @@ struct sl_softc { long sc_abortcount; /* number of abort escape chars */ long sc_starttime; /* time of first abort in window */ u_int sc_keepalive; /* time to decide link hang */ - u_int sc_outfill; /* time to send FRAME_END when output idle */ + u_int sc_outfill; /* time to send FRAME_END when output idle */ + /* + * Handles for scheduling outfill and + * keepalive timeouts. + */ + struct callout_handle sc_ofhandle; + struct callout_handle sc_kahandle; #ifdef INET /* XXX */ struct slcompress sc_comp; /* tcp compression data */ #endif diff --git a/sys/net/if_sppp.h b/sys/net/if_sppp.h index 3bee402..e0e61bb 100644 --- a/sys/net/if_sppp.h +++ b/sys/net/if_sppp.h @@ -16,7 +16,7 @@ * * From: Version 1.7, Wed Jun 7 22:12:02 MSD 1995 * - * $Id: if_sppp.h,v 1.5 1997/05/19 22:03:08 joerg Exp $ + * $Id: if_sppp.h,v 1.6 1997/05/22 22:15:39 joerg Exp $ */ #ifndef _NET_IF_HDLC_H_ @@ -75,6 +75,7 @@ struct sppp { u_char confid[IDX_COUNT]; /* id of last configuration request */ int rst_counter[IDX_COUNT]; /* restart counter */ int fail_counter[IDX_COUNT]; /* negotiation failure counter */ + struct callout_handle ch[IDX_COUNT]; struct slcp lcp; /* LCP params */ struct sipcp ipcp; /* IPCP params */ /* diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 1133938..3e1b854 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -17,7 +17,7 @@ * * From: Version 1.9, Wed Oct 4 18:58:15 MSK 1995 * - * $Id: if_spppsubr.c,v 1.25 1997/08/12 05:22:54 kjc Exp $ + * $Id: if_spppsubr.c,v 1.26 1997/09/02 01:18:37 bde Exp $ */ #include <sys/param.h> @@ -265,6 +265,7 @@ static const char *sppp_phase_name(enum ppp_phase phase); static const char *sppp_proto_name(u_short proto); static void sppp_keepalive(void *dummy); +static struct callout_handle keepalive_ch; static void sppp_qflush(struct ifqueue *ifq); static void sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst); @@ -627,7 +628,7 @@ sppp_attach(struct ifnet *ifp) /* Initialize keepalive handler. */ if (! spppq) - timeout (sppp_keepalive, 0, hz * 10); + keepalive_ch = timeout (sppp_keepalive, 0, hz * 10); /* Insert new entry into the keepalive list. */ sp->pp_next = spppq; @@ -664,10 +665,10 @@ sppp_detach(struct ifnet *ifp) /* Stop keepalive handler. */ if (! spppq) - untimeout (sppp_keepalive, 0); + untimeout (sppp_keepalive, 0, keepalive_ch); for (i = 0; i < IDX_COUNT; i++) - untimeout((cps[i])->TO, (void *)sp); + untimeout((cps[i])->TO, (void *)sp, sp->ch[i]); } /* @@ -1522,7 +1523,8 @@ sppp_to_event(const struct cp *cp, struct sppp *sp) case STATE_STOPPING: sppp_cp_send(sp, cp->proto, TERM_REQ, ++sp->pp_seq, 0, 0); - timeout(cp->TO, (void *)sp, sp->lcp.timeout); + sp->ch[cp->protoidx] = timeout(cp->TO, (void *)sp, + sp->lcp.timeout); break; case STATE_REQ_SENT: case STATE_ACK_RCVD: @@ -1532,7 +1534,8 @@ sppp_to_event(const struct cp *cp, struct sppp *sp) break; case STATE_ACK_SENT: (cp->scr)(sp); - timeout(cp->TO, (void *)sp, sp->lcp.timeout); + sp->ch[cp->protoidx] = timeout(cp->TO, (void *)sp, + sp->lcp.timeout); break; } @@ -1548,7 +1551,7 @@ sppp_cp_change_state(const struct cp *cp, struct sppp *sp, int newstate) { sp->state[cp->protoidx] = newstate; - untimeout(cp->TO, (void *)sp); + untimeout(cp->TO, (void *)sp, sp->ch[cp->protoidx]); switch (newstate) { case STATE_INITIAL: case STATE_STARTING: @@ -1561,7 +1564,8 @@ sppp_cp_change_state(const struct cp *cp, struct sppp *sp, int newstate) case STATE_REQ_SENT: case STATE_ACK_RCVD: case STATE_ACK_SENT: - timeout(cp->TO, (void *)sp, sp->lcp.timeout); + sp->ch[cp->protoidx] = timeout(cp->TO, (void *)sp, + sp->lcp.timeout); break; } } @@ -1581,6 +1585,7 @@ sppp_lcp_init(struct sppp *sp) sp->fail_counter[IDX_LCP] = 0; sp->lcp.protos = 0; sp->lcp.mru = sp->lcp.their_mru = PP_MTU; + callout_handle_init(&sp->ch[IDX_LCP]); /* * Initialize counters and timeout values. Note that we don't @@ -2111,6 +2116,7 @@ sppp_ipcp_init(struct sppp *sp) sp->ipcp.flags = 0; sp->state[IDX_IPCP] = STATE_INITIAL; sp->fail_counter[IDX_IPCP] = 0; + callout_handle_init(&sp->ch[IDX_IPCP]); } static void @@ -2577,7 +2583,7 @@ sppp_keepalive(void *dummy) } } splx(s); - timeout(sppp_keepalive, 0, hz * 10); + keepalive_ch = timeout(sppp_keepalive, 0, hz * 10); } /* diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index d830c60..88c66b5 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -70,7 +70,7 @@ * Paul Mackerras (paulus@cs.anu.edu.au). */ -/* $Id: ppp_tty.c,v 1.22 1997/08/19 14:10:47 peter Exp $ */ +/* $Id: ppp_tty.c,v 1.23 1997/08/22 11:34:08 peter Exp $ */ #include "ppp.h" #if NPPP > 0 @@ -322,7 +322,7 @@ pppasyncrelinq(sc) sc->sc_m = NULL; } if (sc->sc_flags & SC_TIMEOUT) { - untimeout(ppp_timeout, (void *) sc); + untimeout(ppp_timeout, (void *) sc, sc->sc_ch); sc->sc_flags &= ~SC_TIMEOUT; } splx(s); @@ -758,7 +758,7 @@ pppasyncstart(sc) * drained the t_outq. */ if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) { - timeout(ppp_timeout, (void *) sc, 1); + sc->sc_ch = timeout(ppp_timeout, (void *) sc, 1); sc->sc_flags |= SC_TIMEOUT; } |