Straigthen out the use of the tls and tlf callbacks.

Not tested on the if_sr, if_cx and if_ar drivers, but
expected to work just the same as it used to.

Any users of these drivers (or even better: donors
of hardware for them) please contact phk@freebsd.org
so we can test the next batch of changes to if_sppp.
This commit is contained in:
phk 1998-12-16 18:42:38 +00:00
parent 28d6420f45
commit 4674dad527
8 changed files with 20 additions and 84 deletions

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ar.c,v 1.22 1998/08/24 02:28:15 bde Exp $
* $Id: if_ar.c,v 1.23 1998/10/22 05:58:38 bde Exp $
*/
/*
@ -357,13 +357,6 @@ arattach(struct isa_device *id)
sppp_attach((struct ifnet *)&sc->ifsppp);
if_attach(ifp);
/*
* Shortcut the sppp tls/tlf actions to up/down events
* since our lower layer is always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
#if NBPFILTER > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ar.c,v 1.22 1998/08/24 02:28:15 bde Exp $
* $Id: if_ar.c,v 1.23 1998/10/22 05:58:38 bde Exp $
*/
/*
@ -357,13 +357,6 @@ arattach(struct isa_device *id)
sppp_attach((struct ifnet *)&sc->ifsppp);
if_attach(ifp);
/*
* Shortcut the sppp tls/tlf actions to up/down events
* since our lower layer is always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
#if NBPFILTER > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif

View File

@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_sr.c,v 1.15 1998/06/21 14:53:12 bde Exp $
* $Id: if_sr.c,v 1.16 1998/10/22 05:58:39 bde Exp $
*/
/*
@ -1311,13 +1311,6 @@ srioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sc->ifsppp.pp_flags |= PP_KEEPALIVE;
sppp_attach(&sc->ifsppp.pp_if);
/*
* Shortcut the sppp tls/tlf actions to
* up/down events since our lower layer is
* always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
}
sc->attached = sc->protocol;
@ -1502,13 +1495,6 @@ sr_up(struct sr_softc *sc)
sc->ifsppp.pp_flags |= PP_KEEPALIVE;
sppp_attach(&sc->ifsppp.pp_if);
/*
* Shortcut the sppp tls/tlf actions to
* up/down events since our lower layer is
* always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
}
sc->attached = sc->protocol;

View File

@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_sr.c,v 1.15 1998/06/21 14:53:12 bde Exp $
* $Id: if_sr.c,v 1.16 1998/10/22 05:58:39 bde Exp $
*/
/*
@ -1311,13 +1311,6 @@ srioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sc->ifsppp.pp_flags |= PP_KEEPALIVE;
sppp_attach(&sc->ifsppp.pp_if);
/*
* Shortcut the sppp tls/tlf actions to
* up/down events since our lower layer is
* always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
}
sc->attached = sc->protocol;
@ -1502,13 +1495,6 @@ sr_up(struct sr_softc *sc)
sc->ifsppp.pp_flags |= PP_KEEPALIVE;
sppp_attach(&sc->ifsppp.pp_if);
/*
* Shortcut the sppp tls/tlf actions to
* up/down events since our lower layer is
* always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
}
sc->attached = sc->protocol;

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ar.c,v 1.22 1998/08/24 02:28:15 bde Exp $
* $Id: if_ar.c,v 1.23 1998/10/22 05:58:38 bde Exp $
*/
/*
@ -357,13 +357,6 @@ arattach(struct isa_device *id)
sppp_attach((struct ifnet *)&sc->ifsppp);
if_attach(ifp);
/*
* Shortcut the sppp tls/tlf actions to up/down events
* since our lower layer is always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
#if NBPFILTER > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif

View File

@ -284,13 +284,7 @@ cxattach (struct isa_device *id)
/* Init routine is never called by upper level? */
sppp_attach (c->ifp);
if_attach (c->ifp);
/*
* Shortcut the sppp tls/tlf actions to up/down
* events since our lower layer is always ready.
*/
sp = (struct sppp*) c->ifp;
sp->pp_tls = sp->pp_up;
sp->pp_tlf = sp->pp_down;
#if NBPFILTER > 0
/* If BPF is in the kernel, call the attach for it. */
bpfattach (c->ifp, DLT_PPP, PPP_HEADER_LEN);

View File

@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_sr.c,v 1.15 1998/06/21 14:53:12 bde Exp $
* $Id: if_sr.c,v 1.16 1998/10/22 05:58:39 bde Exp $
*/
/*
@ -1311,13 +1311,6 @@ srioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sc->ifsppp.pp_flags |= PP_KEEPALIVE;
sppp_attach(&sc->ifsppp.pp_if);
/*
* Shortcut the sppp tls/tlf actions to
* up/down events since our lower layer is
* always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
}
sc->attached = sc->protocol;
@ -1502,13 +1495,6 @@ sr_up(struct sr_softc *sc)
sc->ifsppp.pp_flags |= PP_KEEPALIVE;
sppp_attach(&sc->ifsppp.pp_if);
/*
* Shortcut the sppp tls/tlf actions to
* up/down events since our lower layer is
* always ready.
*/
sc->ifsppp.pp_tls = sc->ifsppp.pp_up;
sc->ifsppp.pp_tlf = sc->ifsppp.pp_down;
}
sc->attached = sc->protocol;

View File

@ -17,7 +17,7 @@
*
* From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
*
* $Id: if_spppsubr.c,v 1.46 1998/12/04 22:54:52 archie Exp $
* $Id: if_spppsubr.c,v 1.47 1998/12/11 21:40:13 phk Exp $
*/
#include <sys/param.h>
@ -1405,12 +1405,12 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
case STATE_ACK_SENT:
break;
case STATE_CLOSING:
(cp->tlf)(sp);
sppp_cp_change_state(cp, sp, STATE_CLOSED);
(cp->tlf)(sp);
break;
case STATE_STOPPING:
(cp->tlf)(sp);
sppp_cp_change_state(cp, sp, STATE_STOPPED);
(cp->tlf)(sp);
break;
case STATE_ACK_RCVD:
sppp_cp_change_state(cp, sp, STATE_REQ_SENT);
@ -1575,8 +1575,9 @@ sppp_down_event(const struct cp *cp, struct sppp *sp)
sppp_cp_change_state(cp, sp, STATE_INITIAL);
break;
case STATE_STOPPED:
sppp_cp_change_state(cp, sp, STATE_STARTING);
(cp->tls)(sp);
/* fall through */
break;
case STATE_STOPPING:
case STATE_REQ_SENT:
case STATE_ACK_RCVD:
@ -1607,8 +1608,8 @@ sppp_open_event(const struct cp *cp, struct sppp *sp)
switch (sp->state[cp->protoidx]) {
case STATE_INITIAL:
(cp->tls)(sp);
sppp_cp_change_state(cp, sp, STATE_STARTING);
(cp->tls)(sp);
break;
case STATE_STARTING:
break;
@ -1647,8 +1648,8 @@ sppp_close_event(const struct cp *cp, struct sppp *sp)
case STATE_CLOSING:
break;
case STATE_STARTING:
(cp->tlf)(sp);
sppp_cp_change_state(cp, sp, STATE_INITIAL);
(cp->tlf)(sp);
break;
case STATE_STOPPED:
sppp_cp_change_state(cp, sp, STATE_CLOSED);
@ -1686,18 +1687,18 @@ sppp_to_event(const struct cp *cp, struct sppp *sp)
/* TO- event */
switch (sp->state[cp->protoidx]) {
case STATE_CLOSING:
(cp->tlf)(sp);
sppp_cp_change_state(cp, sp, STATE_CLOSED);
(cp->tlf)(sp);
break;
case STATE_STOPPING:
(cp->tlf)(sp);
sppp_cp_change_state(cp, sp, STATE_STOPPED);
(cp->tlf)(sp);
break;
case STATE_REQ_SENT:
case STATE_ACK_RCVD:
case STATE_ACK_SENT:
(cp->tlf)(sp);
sppp_cp_change_state(cp, sp, STATE_STOPPED);
(cp->tlf)(sp);
break;
}
else
@ -2336,6 +2337,8 @@ sppp_lcp_tls(struct sppp *sp)
/* Notify lower layer if desired. */
if (sp->pp_tls)
(sp->pp_tls)(sp);
else
(sp->pp_up)(sp);
}
static void
@ -2350,6 +2353,8 @@ sppp_lcp_tlf(struct sppp *sp)
/* Notify lower layer if desired. */
if (sp->pp_tlf)
(sp->pp_tlf)(sp);
else
(sp->pp_down)(sp);
}
static void