--- Net2/net/if_sl.c 2018/04/24 18:04:02 1.1 +++ Net2/net/if_sl.c 2018/04/24 18:05:57 1.1.1.2 @@ -64,7 +64,7 @@ * interrupts and network activity; thus, splimp must be >= spltty. */ -/* $Header: /var/lib/cvsd/net2/Net2/net/if_sl.c,v 1.1 2018/04/24 18:04:02 root Exp $ */ +/* $Header: /var/lib/cvsd/net2/Net2/net/if_sl.c,v 1.1.1.2 2018/04/24 18:05:57 root Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ #include "sl.h" @@ -390,7 +390,7 @@ sloutput(ifp, m, dst) } IF_ENQUEUE(ifq, m); sc->sc_if.if_lastchange = time; - if (sc->sc_ttyp->t_outq.c_cc == 0) + if (RB_LEN(&sc->sc_ttyp->t_out) == 0) slstart(sc->sc_ttyp); splx(s); return (0); @@ -409,7 +409,6 @@ slstart(tp) register u_char *cp; int s; struct mbuf *m2; - extern int cfreecount; for (;;) { /* @@ -417,9 +416,9 @@ slstart(tp) * We are being called in lieu of ttstart and must do what * it would. */ - if (tp->t_outq.c_cc != 0) { + if (RB_LEN(&tp->t_out) != 0) { (*tp->t_oproc)(tp); - if (tp->t_outq.c_cc > SLIP_HIWAT) + if (RB_LEN(&tp->t_out) > SLIP_HIWAT) return; } /* @@ -444,7 +443,7 @@ slstart(tp) * output queue (if the stuff was important, it'll get * retransmitted). */ - if (cfreecount < CLISTRESERVE + SLMTU) { + if (RB_LEN(&tp->t_out) < SLMTU) { m_freem(m); sc->sc_if.if_collisions++; continue; @@ -455,9 +454,9 @@ slstart(tp) * will flush any accumulated garbage. We do this whenever * the line may have been idle for some time. */ - if (tp->t_outq.c_cc == 0) { + if (RB_LEN(&tp->t_out) == 0) { ++sc->sc_bytessent; - (void) putc(FRAME_END, &tp->t_outq); + (void) putc(FRAME_END, &tp->t_out); } while (m) { @@ -481,12 +480,24 @@ slstart(tp) } out: if (cp > bp) { + int cc; /* * Put n characters at once * into the tty output queue. */ +#ifdef was if (b_to_q((char *)bp, cp - bp, &tp->t_outq)) break; +#else + if (cc = RB_CONTIGPUT(&tp->t_out)) { + cc = min (cc, cp - bp); + bcopy((char *)bp, + tp->t_out.rb_tl, cc); + tp->t_out.rb_tl = + RB_ROLLOVER(&tp->t_out, tp->t_out.rb_tl + cc); + } else + break; +#endif sc->sc_bytessent += cp - bp; } /* @@ -495,12 +506,12 @@ slstart(tp) * Put it out in a different form. */ if (cp < ep) { - if (putc(FRAME_ESCAPE, &tp->t_outq)) + if (putc(FRAME_ESCAPE, &tp->t_out)) break; if (putc(*cp++ == FRAME_ESCAPE ? TRANS_FRAME_ESCAPE : TRANS_FRAME_END, - &tp->t_outq)) { - (void) unputc(&tp->t_outq); + &tp->t_out)) { + (void) unputc(&tp->t_out); break; } sc->sc_bytessent += 2; @@ -510,7 +521,7 @@ slstart(tp) m = m2; } - if (putc(FRAME_END, &tp->t_outq)) { + if (putc(FRAME_END, &tp->t_out)) { /* * Not enough room. Remove a char to make room * and end the packet normally. @@ -518,8 +529,8 @@ slstart(tp) * a day) you probably do not have enough clists * and you should increase "nclist" in param.c. */ - (void) unputc(&tp->t_outq); - (void) putc(FRAME_END, &tp->t_outq); + (void) unputc(&tp->t_out); + (void) putc(FRAME_END, &tp->t_out); sc->sc_if.if_collisions++; } else { ++sc->sc_bytessent;