more mitre decbit changes
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 17 Jan 1990 14:42:34 +0000 (06:42 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 17 Jan 1990 14:42:34 +0000 (06:42 -0800)
SCCS-vsn: sys/netiso/tp.trans 7.4

usr/src/sys/netiso/tp.trans

index 7dd5a30..fb8c5d9 100644 (file)
@@ -540,6 +540,7 @@ TP_OPEN                     <==             TP_CRSENT                                                                       CC_TPDU
                IncStat(ts_tp4_conn);
                $P.tp_fref = $$.e_sref;
                $P.tp_fcredit = $$.e_cdt;
                IncStat(ts_tp4_conn);
                $P.tp_fref = $$.e_sref;
                $P.tp_fcredit = $$.e_cdt;
+               $P.tp_ackrcvd = 0;
                if($P.tp_rx_strat & TPRX_FASTSTART)
                        $P.tp_cong_win = $$.e_cdt;
                tp_getoptions($P);
                if($P.tp_rx_strat & TPRX_FASTSTART)
                        $P.tp_cong_win = $$.e_cdt;
                tp_getoptions($P);
@@ -573,6 +574,8 @@ SAME                        <==             TP_CRSENT                                                                       TM_retrans
                int error;
 
                IncStat(ts_retrans_cr);
                int error;
 
                IncStat(ts_retrans_cr);
+               $P.tp_cong_win = 1;
+               $P.tp_ackrcvd = 0;
                data = MCPY($P.tp_ucddata, M_NOWAIT);
                if($P.tp_ucddata) {
                        IFDEBUG(D_CONN)
                data = MCPY($P.tp_ucddata, M_NOWAIT);
                if($P.tp_ucddata) {
                        IFDEBUG(D_CONN)
@@ -935,6 +938,9 @@ SAME                        <==             TP_AKWAIT                                                                       TM_retrans
 
                IncStat(ts_retrans_cc);
                $P.tp_retrans --;
 
                IncStat(ts_retrans_cc);
                $P.tp_retrans --;
+               $P.tp_cong_win = 1;
+               $P.tp_ackrcvd = 0;
+
                if( error = tp_emit(CC_TPDU_type, $P, 0, 0, data) ) 
                        $P.tp_sock->so_error = error;
                tp_ctimeout($P.tp_refp, TM_retrans, (int)$P.tp_cc_ticks);
                if( error = tp_emit(CC_TPDU_type, $P, 0, 0, data) ) 
                        $P.tp_sock->so_error = error;
                tp_ctimeout($P.tp_refp, TM_retrans, (int)$P.tp_cc_ticks);
@@ -982,6 +988,8 @@ TP_CLOSING          <==             TP_OPEN            [ TM_inact, TM_retrans, TM_data_retrans ]
 SAME                   <==             TP_OPEN                                                                         TM_retrans
        ( $P.tp_retrans > 0 )
        {
 SAME                   <==             TP_OPEN                                                                         TM_retrans
        ( $P.tp_retrans > 0 )
        {
+               $P.tp_cong_win = 1;
+               $P.tp_ackrcvd = 0;
                /* resume XPD */
                if      ( $P.tp_Xsnd.sb_mb )  {
                        struct mbuf *m = m_copy($P.tp_Xsnd.sb_mb, 0, (int)$P.tp_Xsnd.sb_cc);
                /* resume XPD */
                if      ( $P.tp_Xsnd.sb_mb )  {
                        struct mbuf *m = m_copy($P.tp_Xsnd.sb_mb, 0, (int)$P.tp_Xsnd.sb_cc);
@@ -1014,9 +1022,13 @@ SAME                     <==             TP_OPEN                                                                 TM_data_retrans
                register        struct mbuf     *m;
                register        SeqNum                  high = $$.e_high;
 
                register        struct mbuf     *m;
                register        SeqNum                  high = $$.e_high;
 
-               low =
-                       SEQ_GT($P, $P.tp_snduna, $$.e_low )? $P.tp_snduna: $$.e_low;
-               lowsave = low;
+               low = $P.tp_snduna;
+               lowsave = high = low;
+
+               tp_euntimeout_lss($P.tp_refp, TM_data_retrans,
+                       SEQ_ADD($P, $P.tp_sndhiwat, 1));
+               $P.tp_retrans_hiwat = $P.tp_sndhiwat;
+
                if (($P.tp_rx_strat & TPRX_EACH) == 0)
                        high = (high>low)?low:high;
 
                if (($P.tp_rx_strat & TPRX_EACH) == 0)
                        high = (high>low)?low:high;
 
@@ -1024,10 +1036,11 @@ SAME                    <==             TP_OPEN                                                                 TM_data_retrans
                        register int i;
 
                        $P.tp_cong_win = 1;
                        register int i;
 
                        $P.tp_cong_win = 1;
-
+                       $P.tp_ackrcvd = 0;
                        i = SEQ_ADD($P, low, $P.tp_cong_win);
                        i = SEQ_ADD($P, low, $P.tp_cong_win);
-                       if(SEQ_LT($P, i, high ))
-                               high = i;
+
+                       high = SEQ_MIN($P, high, $P.tp_sndhiwat);
+
                }
 
                while( SEQ_LEQ($P, low, high) ){
                }
 
                while( SEQ_LEQ($P, low, high) ){
@@ -1046,12 +1059,16 @@ SAME                    <==             TP_OPEN                                                                 TM_data_retrans
                        }
                        r = r->tprt_next;
                }
                        }
                        r = r->tprt_next;
                }
+/* CE_BIT
                if ( SEQ_LEQ($P, lowsave, high) ){
                if ( SEQ_LEQ($P, lowsave, high) ){
+*/
                        $$.e_retrans --;
                        tp_etimeout($P.tp_refp, TM_data_retrans, (caddr_t)lowsave,
                                        (caddr_t)high, $$.e_retrans,
                                        ($P.tp_Nretrans - $$.e_retrans) * (int)$P.tp_dt_ticks);
                        $$.e_retrans --;
                        tp_etimeout($P.tp_refp, TM_data_retrans, (caddr_t)lowsave,
                                        (caddr_t)high, $$.e_retrans,
                                        ($P.tp_Nretrans - $$.e_retrans) * (int)$P.tp_dt_ticks);
+/* CE_BIT
                }
                }
+*/
        }
 ;
 
        }
 ;
 
@@ -1172,7 +1189,48 @@ SAME                     <==             TP_OPEN                                                                         AK_TPDU
                }
                sbwakeup( &$P.tp_sock->so_snd );
 
                }
                sbwakeup( &$P.tp_sock->so_snd );
 
-               tp_send($P);
+               if ($P.tp_sndhiwat <= $P.tp_retrans_hiwat &&
+                       $P.tp_snduna <= $P.tp_retrans_hiwat) {
+
+                       register    struct mbuf     *m;
+                       /* extern      struct mbuf     *m_copy(); */
+                       register    struct tp_rtc   *r;
+                       SeqNum      high, retrans, low_save;
+
+                       high = SEQ_MIN($P, SEQ_ADD($P, $P.tp_snduna,
+                                       MIN($P.tp_cong_win, $P.tp_fcredit)) - 1,
+                                       $P.tp_sndhiwat);
+                       low_save = retrans = SEQ_MAX($P, SEQ_ADD($P, $P.tp_last_retrans, 1),
+                                       $P.tp_snduna);
+                       for (; SEQ_LEQ($P, retrans, high); SEQ_INC($P, retrans)) {
+
+                               for (r = $P.tp_snduna_rtc; r; r = r->tprt_next){
+                                       if ( r->tprt_seq == retrans ){
+                                               if(( m = m_copy(r->tprt_data, 0, r->tprt_octets ))
+                                                               == MNULL)
+                                                       break;
+                                               (void) tp_emit(DT_TPDU_type, $P, retrans,
+                                                       r->tprt_eot, m);
+                                               $P.tp_last_retrans = retrans;
+                                               IncStat(ts_retrans_dt);
+                                               break;
+                                       }
+                               }
+                               if ( r == (struct tp_rtc *)0 ){
+                                       IFDEBUG(D_RTC)
+                                               printf( "tp: retrans rtc list is GONE!\n");
+                                       ENDDEBUG
+                                       break;
+                               }
+                       }
+                       tp_etimeout($P.tp_refp, TM_data_retrans, (caddr_t)low_save,
+                                       (caddr_t)high, $P.tp_retrans, (int)$P.tp_dt_ticks);
+                       if (SEQ_DEC($P, retrans) == $P.tp_retrans_hiwat)
+                               tp_send($P);
+               }
+               else {
+                       tp_send($P);
+               }
                IFDEBUG(D_ACKRECV)
                        printf("GOOD ACK new sndhiwat 0x%x\n", $P.tp_sndhiwat);
                ENDDEBUG
                IFDEBUG(D_ACKRECV)
                        printf("GOOD ACK new sndhiwat 0x%x\n", $P.tp_sndhiwat);
                ENDDEBUG
@@ -1278,7 +1336,13 @@ SAME                     <==             TP_OPEN                                                                         T_USR_rcvd
        {       
                if( trick_hc ) {
                        IncStat(ts_ackreason[_ACK_USRRCV_]);
        {       
                if( trick_hc ) {
                        IncStat(ts_ackreason[_ACK_USRRCV_]);
-                       return tp_emit(AK_TPDU_type, $P, $P.tp_rcvnxt, 0, MNULL);
+
+                       /* send an ACK only if there's new information */
+                       LOCAL_CREDIT( $P );
+                       if (($P.tp_rcvnxt != $P.tp_sent_rcvnxt) ||
+                               ($P.tp_lcredit != $P.tp_sent_lcdt))
+
+                               return tp_emit(AK_TPDU_type, $P, $P.tp_rcvnxt, 0, MNULL);
                }
        }
 ;
                }
        }
 ;