BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / netiso / tp_subr.c
index fc44d14..0732344 100644 (file)
@@ -1,3 +1,38 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)tp_subr.c   7.9 (Berkeley) 6/27/91
+ */
+
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
@@ -29,7 +64,6 @@ SOFTWARE.
  *
  * $Header: tp_subr.c,v 5.3 88/11/18 17:28:43 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_subr.c,v $
  *
  * $Header: tp_subr.c,v 5.3 88/11/18 17:28:43 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_subr.c,v $
- *     @(#)tp_subr.c   7.6 (Berkeley) 7/24/90
  *
  * The main work of data transfer is done here.
  * These routines are called from tp.trans.
  *
  * The main work of data transfer is done here.
  * These routines are called from tp.trans.
@@ -40,10 +74,6 @@ SOFTWARE.
  * and put incoming packet data into socket buffers (tp_stash()).
  */
 
  * and put incoming packet data into socket buffers (tp_stash()).
  */
 
-#ifndef lint
-static char *rcsid = "$Header: tp_subr.c,v 5.3 88/11/18 17:28:43 nhall Exp $";
-#endif lint
-
 #include "param.h"
 #include "mbuf.h"
 #include "socket.h"
 #include "param.h"
 #include "mbuf.h"
 #include "socket.h"
@@ -409,7 +439,11 @@ tp_send(tpcb)
        SeqNum                                  lowseq, highseq ;
        SeqNum                                  lowsave; 
 #ifdef TP_PERF_MEAS
        SeqNum                                  lowseq, highseq ;
        SeqNum                                  lowsave; 
 #ifdef TP_PERF_MEAS
+
        struct timeval                  send_start_time;
        struct timeval                  send_start_time;
+       IFPERF(tpcb)
+               GET_CUR_TIME(&send_start_time);
+       ENDPERF
 #endif TP_PERF_MEAS
 
        lowsave =  lowseq = SEQ(tpcb, tpcb->tp_sndhiwat + 1);
 #endif TP_PERF_MEAS
 
        lowsave =  lowseq = SEQ(tpcb, tpcb->tp_sndhiwat + 1);
@@ -443,10 +477,6 @@ tp_send(tpcb)
        if      ( SEQ_GT(tpcb, lowseq, highseq) )
                        return ; /* don't send, don't change hiwat, don't set timers */
 
        if      ( SEQ_GT(tpcb, lowseq, highseq) )
                        return ; /* don't send, don't change hiwat, don't set timers */
 
-       IFPERF(tpcb)
-               GET_CUR_TIME(&send_start_time);
-       ENDPERF
-
        ASSERT( SEQ_LEQ(tpcb, lowseq, highseq) );
        SEQ_DEC(tpcb, lowseq);
 
        ASSERT( SEQ_LEQ(tpcb, lowseq, highseq) );
        SEQ_DEC(tpcb, lowseq);
 
@@ -560,6 +590,7 @@ tp_send(tpcb)
        }
 
 done:
        }
 
 done:
+#ifdef TP_PERF_MEAS
        IFPERF(tpcb)
                {
                        register int npkts;
        IFPERF(tpcb)
                {
                        register int npkts;
@@ -593,6 +624,7 @@ done:
                                        TPsbsend, &send_end_time, lowsave, tpcb->tp_Nwindow, npkts);
                }
        ENDPERF
                                        TPsbsend, &send_end_time, lowsave, tpcb->tp_Nwindow, npkts);
                }
        ENDPERF
+#endif TP_PERF_MEAS
 
        tpcb->tp_sndhiwat = lowseq;
 
 
        tpcb->tp_sndhiwat = lowseq;
 
@@ -823,43 +855,3 @@ done:
                }
        }
 }
                }
        }
 }
-
-/* class zero version */
-void
-tp0_stash( tpcb, e )
-       register struct tp_pcb          *tpcb;
-       register struct tp_event        *e;
-{
-#ifndef lint
-#define E e->ATTR(DT_TPDU)
-#else lint
-#define E e->ev_union.EV_DT_TPDU
-#endif lint
-
-       IFPERF(tpcb)
-               PStat(tpcb, Nb_from_ll) += E.e_datalen;
-               tpmeas(tpcb->tp_lref, TPtime_from_ll, &e->e_time,
-                               E.e_seq, PStat(tpcb, Nb_from_ll), E.e_datalen);
-       ENDPERF
-
-       IFDEBUG(D_STASH)
-               printf("stash EQ: seq 0x%x datalen 0x%x eot 0x%x", 
-               E.e_seq, E.e_datalen, E.e_eot);
-       ENDDEBUG
-
-       IFTRACE(D_STASH)
-               tptraceTPCB(TPPTmisc, "stash EQ: seq len eot", 
-               E.e_seq, E.e_datalen, E.e_eot, 0);
-       ENDTRACE
-
-       if ( E.e_eot ) {
-               register struct mbuf *n = E.e_data;
-               n->m_flags |= M_EOR;
-               n->m_act = MNULL; /* set on tp_input */
-       }
-       sbappend(&tpcb->tp_sock->so_rcv, E.e_data);
-       IFDEBUG(D_STASH)
-               dump_mbuf(tpcb->tp_sock->so_rcv.sb_mb, 
-                       "stash 0: so_rcv after appending");
-       ENDDEBUG
-}