fixes to tracing and avoiding silly window between
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 22 Sep 1989 15:44:21 +0000 (07:44 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 22 Sep 1989 15:44:21 +0000 (07:44 -0800)
socket layer and transport; more changes to come to usrreq and tp_send.

SCCS-vsn: sys/netiso/tp_input.c 7.4
SCCS-vsn: sys/netiso/tp_meas.h 7.4
SCCS-vsn: sys/netiso/tp_usrreq.c 7.5
SCCS-vsn: sys/netiso/tp_pcb.c 7.4
SCCS-vsn: sys/netiso/tp_subr.c 7.4

usr/src/sys/netiso/tp_input.c
usr/src/sys/netiso/tp_meas.h
usr/src/sys/netiso/tp_pcb.c
usr/src/sys/netiso/tp_subr.c
usr/src/sys/netiso/tp_usrreq.c

index ad697d9..9a3a306 100644 (file)
@@ -29,7 +29,7 @@ SOFTWARE.
  *
  * $Header: tp_input.c,v 5.6 88/11/18 17:27:38 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_input.c,v $
  *
  * $Header: tp_input.c,v 5.6 88/11/18 17:27:38 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_input.c,v $
- *     @(#)tp_input.c  7.3 (Berkeley) %G% *
+ *     @(#)tp_input.c  7.4 (Berkeley) %G% *
  *
  * tp_input() gets an mbuf chain from ip.  Actually, not directly
  * from ip, because ip calls a net-level routine that strips off
  *
  * tp_input() gets an mbuf chain from ip.  Actually, not directly
  * from ip, because ip calls a net-level routine that strips off
@@ -229,7 +229,7 @@ tp_newsocket(so, fname, cons_channel, class_to_use, netservice)
         */
        IFTRACE(D_NEWSOCK)
                tptraceTPCB(TPPTmisc, "newsock: listg_so, _tpcb, so_head",
         */
        IFTRACE(D_NEWSOCK)
                tptraceTPCB(TPPTmisc, "newsock: listg_so, _tpcb, so_head",
-                       so, tpcb, so->so_head);
+                       so, tpcb, so->so_head, 0);
        ENDTRACE        
 
        if ((so = sonewsock(so, SS_ISCONFIRMING)) == (struct socket *)0)
        ENDTRACE        
 
        if ((so = sonewsock(so, SS_ISCONFIRMING)) == (struct socket *)0)
index 1251b9f..949882d 100644 (file)
@@ -1,5 +1,5 @@
 /***********************************************************
 /***********************************************************
-               Copyright IBM Corporation 1987
+                               Copyright IBM Corporation 1987
 
                       All Rights Reserved
 
 
                       All Rights Reserved
 
@@ -24,13 +24,10 @@ SOFTWARE.
 /*
  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  */
 /*
  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  */
-/*     @(#)tp_meas.h   7.3 (Berkeley) %G% */
-#ifdef TPPT
-#define TP_PERF_MEAS
-#endif TPPT
+/*     @(#)tp_meas.h   7.4 (Berkeley) %G% */
+#ifdef TP_PERF_MEAS
 #define tpmeas(a, b, t, c, d, e) \
        Tpmeas((u_int)(a), (u_int)(b), t, (u_int)(c), (u_int)(d), (u_int)(e))
 #define tpmeas(a, b, t, c, d, e) \
        Tpmeas((u_int)(a), (u_int)(b), t, (u_int)(c), (u_int)(d), (u_int)(e))
-#ifdef TP_PERF_MEAS
 
 struct tp_Meas {
        int                     tpm_tseq;
 
 struct tp_Meas {
        int                     tpm_tseq;
index f76ab6e..9e4cbd3 100644 (file)
@@ -1,5 +1,5 @@
 /***********************************************************
 /***********************************************************
-               Copyright IBM Corporation 1987
+                               Copyright IBM Corporation 1987
 
                       All Rights Reserved
 
 
                       All Rights Reserved
 
@@ -29,7 +29,7 @@ SOFTWARE.
  *
  * $Header: tp_pcb.c,v 5.4 88/11/18 17:28:24 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_pcb.c,v $
  *
  * $Header: tp_pcb.c,v 5.4 88/11/18 17:28:24 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_pcb.c,v $
- *     @(#)tp_pcb.c    7.3 (Berkeley) %G% *
+ *     @(#)tp_pcb.c    7.4 (Berkeley) %G% *
  *
  *
  * This is the initialization and cleanup stuff - 
  *
  *
  * This is the initialization and cleanup stuff - 
@@ -742,7 +742,7 @@ tp_detach(tpcb)
        ENDDEBUG
        IFTRACE(D_CONN)
                tptraceTPCB(TPPTmisc, "tp_detach tpcb so lsufx", 
        ENDDEBUG
        IFTRACE(D_CONN)
                tptraceTPCB(TPPTmisc, "tp_detach tpcb so lsufx", 
-                       tpcb, so, *(int *)(tpcb->tp_lsuffix), 0);
+                       tpcb, so, *(u_short *)(tpcb->tp_lsuffix), 0);
        ENDTRACE
 
        if (so->so_head) {
        ENDTRACE
 
        if (so->so_head) {
index e42c58d..d11580f 100644 (file)
@@ -29,7 +29,7 @@ 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.3 (Berkeley) %G% *
+ *     @(#)tp_subr.c   7.4 (Berkeley) %G%
  *
  * 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.
@@ -541,8 +541,8 @@ tp_send(tpcb)
 
                IFTRACE(D_DATA)
                        tptraceTPCB( TPPTmisc, 
 
                IFTRACE(D_DATA)
                        tptraceTPCB( TPPTmisc, 
-                               "tp_send emitting DT lowseq eotsdu_reached",
-                               lowseq, eotsdu_reached, 0, 0);
+                               "tp_send emitting DT lowseq eotsdu_reached len",
+                               lowseq, eotsdu_reached, len, 0);
                ENDTRACE
                if( tpcb->tp_sock->so_error =
                        tp_emit(DT_TPDU_type, tpcb, lowseq, eotsdu_reached, m) )  {
                ENDTRACE
                if( tpcb->tp_sock->so_error =
                        tp_emit(DT_TPDU_type, tpcb, lowseq, eotsdu_reached, m) )  {
index a01d32f..ddc5718 100644 (file)
@@ -1,5 +1,5 @@
 /***********************************************************
 /***********************************************************
-               Copyright IBM Corporation 1987
+                               Copyright IBM Corporation 1987
 
                       All Rights Reserved
 
 
                       All Rights Reserved
 
@@ -29,7 +29,7 @@ SOFTWARE.
  *
  * $Header: tp_usrreq.c,v 5.4 88/11/18 17:29:18 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_usrreq.c,v $
  *
  * $Header: tp_usrreq.c,v 5.4 88/11/18 17:29:18 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_usrreq.c,v $
- *     @(#)tp_usrreq.c 7.4 (Berkeley) %G% *
+ *     @(#)tp_usrreq.c 7.5 (Berkeley) %G%
  *
  * tp_usrreq(), the fellow that gets called from most of the socket code.
  * Pretty straighforward.
  *
  * tp_usrreq(), the fellow that gets called from most of the socket code.
  * Pretty straighforward.
@@ -487,8 +487,8 @@ tp_usrreq(so, req, m, nam, rightsp, controlp)
                }
                IFPERF(tpcb)
                        u_int lsufx, fsufx;
                }
                IFPERF(tpcb)
                        u_int lsufx, fsufx;
-                       lsufx = *(u_int *)(tpcb->tp_lsuffix);
-                       fsufx = *(u_int *)(tpcb->tp_fsuffix);
+                       lsufx = *(u_short *)(tpcb->tp_lsuffix);
+                       fsufx = *(u_short *)(tpcb->tp_fsuffix);
 
                        tpmeas( tpcb->tp_lref, 
                                TPtime_open | (tpcb->tp_xtd_format <<4 ), 
 
                        tpmeas( tpcb->tp_lref, 
                                TPtime_open | (tpcb->tp_xtd_format <<4 ), 
@@ -504,8 +504,8 @@ tp_usrreq(so, req, m, nam, rightsp, controlp)
                ENDDEBUG
                IFPERF(tpcb)
                        u_int lsufx, fsufx;
                ENDDEBUG
                IFPERF(tpcb)
                        u_int lsufx, fsufx;
-                       lsufx = *(u_int *)(tpcb->tp_lsuffix);
-                       fsufx = *(u_int *)(tpcb->tp_fsuffix);
+                       lsufx = *(u_short *)(tpcb->tp_lsuffix);
+                       fsufx = *(u_short *)(tpcb->tp_fsuffix);
 
                        tpmeas( tpcb->tp_lref, TPtime_open, 
                                &time, lsufx, fsufx, tpcb->tp_fref);
 
                        tpmeas( tpcb->tp_lref, TPtime_open, 
                                &time, lsufx, fsufx, tpcb->tp_fref);
@@ -597,6 +597,7 @@ tp_usrreq(so, req, m, nam, rightsp, controlp)
                                    - tp_headersize(DT_TPDU_type, tpcb)
                                    - (tpcb->tp_use_checksum?4:0) ;
                        int totlen = n->m_pkthdr.len;
                                    - tp_headersize(DT_TPDU_type, tpcb)
                                    - (tpcb->tp_use_checksum?4:0) ;
                        int totlen = n->m_pkthdr.len;
+                       struct mbuf *nn;
 
                        /*
                         * Could have eotsdu and no data.(presently MUST have
 
                        /*
                         * Could have eotsdu and no data.(presently MUST have
@@ -622,16 +623,50 @@ tp_usrreq(so, req, m, nam, rightsp, controlp)
                         * Pre-packetize the data in the sockbuf
                         * according to negotiated mtu.  Do it here
                         * where we can safely wait for mbufs.
                         * Pre-packetize the data in the sockbuf
                         * according to negotiated mtu.  Do it here
                         * where we can safely wait for mbufs.
+                        *
+                        * This presumes knowledge of sockbuf conventions.
                         */
                         */
-                       while (n->m_pkthdr.len > maxsize) {
-                               struct mbuf *nn
-                                           = m_copym(n, 0, maxsize, M_WAIT);
+                       len = 0;
+                       if (n = sb->sb_mb)
+                               while (n->m_act)
+                                       n = n->m_act;
+                       if (n && n->m_pkthdr.len < maxsize) {
+                               int space = maxsize - n->m_pkthdr.len;
+                               int eorseen = 0;
+                               nn = n; 
+                               for (;; n = n->m_next) {
+                                eorseen |= n->m_flags & M_EOR;
+                                       if (n->m_next == 0)
+                                               break;
+                               }  
+                               if (eorseen)
+                                       goto on1;
+                               if (m->m_pkthdr.len <= space) {
+                                       n->m_next = m; 
+                                       if (eotsdu)
+                                               nn->m_flags |= M_EOR; 
+                                       goto on2; 
+                               } else {   
+                                       nn->m_next = m_copym(n, 0, space, M_WAIT);
+                                       m_adj(n, space);
+                               }
+                       }       
+       on1:    len++;
+                       for (n = m; n->m_pkthdr.len > maxsize;) {
+                               nn = m_copym(n, 0, len, M_WAIT);
                                sbappendrecord(sb, nn);
                                m_adj(n, maxsize);
                                sbappendrecord(sb, nn);
                                m_adj(n, maxsize);
+                               len++;
                        }
                        }
-                       sbappendrecord(sb, n);
-                       if (eotsdu)     /* This presumes knowledge of sbappendrecord() */
+                       if (eotsdu)
                                n->m_flags |= M_EOR;
                                n->m_flags |= M_EOR;
+                       sbappendrecord(sb, n);
+       on2:    
+                       IFTRACE(D_DATA)
+                               tptraceTPCB(TPPTmisc,
+                               "SEND BF: maxsize totlen frags eotsdu",
+                                       maxsize, totlen, len, eotsdu);
+                       ENDTRACE
                        IFDEBUG(D_SYSCALL)
                                printf("PRU_SEND: eot %d after sbappend 0x%x len 0x%x\n",
                                        eotsdu, n, len);
                        IFDEBUG(D_SYSCALL)
                                printf("PRU_SEND: eot %d after sbappend 0x%x len 0x%x\n",
                                        eotsdu, n, len);
@@ -686,6 +721,18 @@ tp_usrreq(so, req, m, nam, rightsp, controlp)
        splx(s);
        return error;
 }
        splx(s);
        return error;
 }
+tp_ltrace(so, uio)
+struct socket *so;
+struct uio *uio;
+{
+       IFTRACE(D_DATA)
+               register struct tp_pcb *tpcb =  sototpcb(so);
+               if (tpcb) {
+                       tptraceTPCB(TPPTmisc, "sosend so resid iovcnt", so,
+                               uio->uio_resid, uio->uio_iovcnt, 0);
+               }
+       ENDTRACE
+}
 
 tp_confirm(tpcb)
 register struct tp_pcb *tpcb;
 
 tp_confirm(tpcb)
 register struct tp_pcb *tpcb;