now that SO_RCVBUF calls down, calculate maxcredit, and use in
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 4 Sep 1991 12:23:20 +0000 (04:23 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 4 Sep 1991 12:23:20 +0000 (04:23 -0800)
LOCAL_CREDIT macro.

SCCS-vsn: sys/netiso/tp_param.h 7.9
SCCS-vsn: sys/netiso/tp_subr.c 7.12
SCCS-vsn: sys/netiso/tp_subr2.c 7.13

usr/src/sys/netiso/tp_param.h
usr/src/sys/netiso/tp_subr.c
usr/src/sys/netiso/tp_subr2.c

index fc5faf7..7242382 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_param.h  7.8 (Berkeley) %G%
+ *     @(#)tp_param.h  7.9 (Berkeley) %G%
  */
 
 /***********************************************************
@@ -308,12 +308,11 @@ bcopy((caddr_t)&(((struct tp_vbp *)(src))->tpv_val),(caddr_t)&(dst),sizeof(type)
 #if defined(ARGO_DEBUG)&&!defined(LOCAL_CREDIT_EXPAND)
 #define LOCAL_CREDIT(tpcb) tp_local_credit(tpcb)
 #else
-#define LOCAL_CREDIT( tpcb ) {\
+#define LOCAL_CREDIT(tpcb) {\
     register struct sockbuf *xxsb = &((tpcb)->tp_sock->so_rcv);\
-    register int xxi = ((xxsb)->sb_hiwat-(xxsb)->sb_cc);\
-    register int maxcredit = ((tpcb)->tp_xtd_format?0xffff:0xf);\
-    xxi = (xxi<0) ? 0 : ((xxi)>>(tpcb)->tp_tpdusize);\
-    xxi = MIN(xxi, maxcredit); \
+    register int xxi = sbspace(xxsb);\
+    xxi = (xxi<0) ? 0 : ((xxi) / (tpcb)->tp_l_tpdusize);\
+    xxi = min(xxi, (tpcb)->tp_maxlcredit); \
     if (!(tpcb->tp_cebit_off)) { \
         (tpcb)->tp_lcredit = ROUND((tpcb)->tp_win_recv); \
         if (xxi < (tpcb)->tp_lcredit) { \
@@ -327,6 +326,10 @@ bcopy((caddr_t)&(((struct tp_vbp *)(src))->tpv_val),(caddr_t)&(dst),sizeof(type)
 #endif ARGO_DEBUG
 
 #ifdef KERNEL
+#ifdef ARGO_DEBUG
+#include "syslog.h"
+#define printf logpri(LOG_DEBUG),addlog
+#endif
 
 #ifndef  tp_NSTATES 
 
index ee7d245..8eaa1cc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_subr.c   7.11 (Berkeley) %G%
+ *     @(#)tp_subr.c   7.12 (Berkeley) %G%
  */
 
 /***********************************************************
@@ -725,10 +725,8 @@ tp_stash( tpcb, e )
                        E.e_seq, tpcb->tp_rcvnxt, tpcb->tp_lcredit, 0);
                ENDTRACE
 
-               if (tpcb->tp_rsyq == 0 ||
-                       (tpcb->tp_rsycnt == 0 &&
-                        (tpcb->tp_sbmax != tpcb->tp_sock->so_rcv.sb_hiwat)))
-                               tp_rsyset(tpcb);
+               if (tpcb->tp_rsyq == 0)
+                       tp_rsyset(tpcb);
                uwe = SEQ(tpcb, tpcb->tp_rcvnxt + tpcb->tp_maxlcredit);
                if (tpcb->tp_rsyq == 0 ||
                                                !IN_RWINDOW(tpcb, E.e_seq, tpcb->tp_rcvnxt, uwe)) {
@@ -841,12 +839,14 @@ register struct tp_pcb *tpcb;
 {
        register struct socket *so = tpcb->tp_sock;
        int maxcredit  = tpcb->tp_xtd_format ? 0xffff : 0xf;
-       caddr_t rsyq;
+       int old_credit = tpcb->tp_maxlcredit;
+       caddr_t rsyq;
 
-       tpcb->tp_sbmax = so->so_rcv.sb_hiwat;
        tpcb->tp_maxlcredit = maxcredit = min(maxcredit,
                  (so->so_rcv.sb_hiwat + tpcb->tp_l_tpdusize)/ tpcb->tp_l_tpdusize);
 
+       if (old_credit == tpcb->tp_maxlcredit && tpcb->tp_rsyq != 0)
+               return;
        maxcredit *= sizeof(struct mbuf *);
        if (tpcb->tp_rsyq)
                tp_rsyflush(tpcb);
index 864f474..52b393e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_subr2.c  7.12 (Berkeley) %G%
+ *     @(#)tp_subr2.c  7.13 (Berkeley) %G%
  */
 
 /***********************************************************
@@ -273,7 +273,8 @@ struct tp_pcb *tpcb;
        tpcb->tp_seqhalf = tpcb->tp_seqbit >> 1;
        tpcb->tp_dt_ticks =
                MAX(tpcb->tp_dt_ticks, (tpcb->tp_peer_acktime + 2));
-
+       (void) tp_rsyset(tpcb);
+       
 }
 
 /*