386BSD 0.1 development
[unix-history] / usr / src / sys.386bsd / net / if_sl.c
index 3569d65..733c7b2 100644 (file)
@@ -443,7 +443,7 @@ slstart(tp)
                 * output queue (if the stuff was important, it'll get
                 * retransmitted).
                 */
                 * output queue (if the stuff was important, it'll get
                 * retransmitted).
                 */
-               if (RB_LEN(&tp->t_out) < SLMTU) {
+               if (RBSZ - RB_LEN(&tp->t_out) < SLMTU) {
                        m_freem(m);
                        sc->sc_if.if_collisions++;
                        continue;
                        m_freem(m);
                        sc->sc_if.if_collisions++;
                        continue;
@@ -488,17 +488,41 @@ slstart(tp)
 #ifdef was
                                        if (b_to_q((char *)bp, cp - bp, &tp->t_outq))
                                                break;
 #ifdef was
                                        if (b_to_q((char *)bp, cp - bp, &tp->t_outq))
                                                break;
+                                       sc->sc_bytessent += cp - bp;
 #else
 #else
+#ifdef works
                                        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);
                                        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);
+                                               sc->sc_bytessent += cc;
+                                               bp += cc;
                                        } else
                                                break;
                                        } else
                                                break;
+                                       if (cp > bp && 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);
+                                               sc->sc_bytessent += cc;
+                                               bp += cc;
+                                       } else
+                                               break;
+#else
+                                       while (cp > bp && (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);
+                                               sc->sc_bytessent += cc;
+                                               bp += cc;
+                                       }
+#endif
 #endif
 #endif
-                                       sc->sc_bytessent += cp - bp;
                                }
                                /*
                                 * If there are characters left in the mbuf,
                                }
                                /*
                                 * If there are characters left in the mbuf,