From: Keith Sklower Date: Wed, 4 Sep 1991 12:23:20 +0000 (-0800) Subject: now that SO_RCVBUF calls down, calculate maxcredit, and use in X-Git-Tag: BSD-4_4-Snapshot-Development~9447 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/7893315bb0282af792cae20ebe87b60a67bbb824?ds=inline now that SO_RCVBUF calls down, calculate maxcredit, and use in 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 --- diff --git a/usr/src/sys/netiso/tp_param.h b/usr/src/sys/netiso/tp_param.h index fc5faf760b..7242382d88 100644 --- a/usr/src/sys/netiso/tp_param.h +++ b/usr/src/sys/netiso/tp_param.h @@ -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 diff --git a/usr/src/sys/netiso/tp_subr.c b/usr/src/sys/netiso/tp_subr.c index ee7d245b6f..8eaa1ccbe8 100644 --- a/usr/src/sys/netiso/tp_subr.c +++ b/usr/src/sys/netiso/tp_subr.c @@ -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); diff --git a/usr/src/sys/netiso/tp_subr2.c b/usr/src/sys/netiso/tp_subr2.c index 864f474d5f..52b393e417 100644 --- a/usr/src/sys/netiso/tp_subr2.c +++ b/usr/src/sys/netiso/tp_subr2.c @@ -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); + } /*