now that SO_RCVBUF calls down, calculate maxcredit, and use in
[unix-history] / usr / src / sys / netiso / tp_param.h
index 1c3531b..7242382 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_param.h  7.7 (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
 #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 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) { \
     if (!(tpcb->tp_cebit_off)) { \
         (tpcb)->tp_lcredit = ROUND((tpcb)->tp_win_recv); \
         if (xxi < (tpcb)->tp_lcredit) { \
@@ -327,11 +326,19 @@ bcopy((caddr_t)&(((struct tp_vbp *)(src))->tpv_val),(caddr_t)&(dst),sizeof(type)
 #endif ARGO_DEBUG
 
 #ifdef KERNEL
 #endif ARGO_DEBUG
 
 #ifdef KERNEL
+#ifdef ARGO_DEBUG
+#include "syslog.h"
+#define printf logpri(LOG_DEBUG),addlog
+#endif
 
 #ifndef  tp_NSTATES 
 
 #include "tp_states.h"
 #include "tp_events.h"
 
 #ifndef  tp_NSTATES 
 
 #include "tp_states.h"
 #include "tp_events.h"
+#if defined(__STDC__) || defined(__cplusplus)
+#undef ATTR
+#define ATTR(X) ev_union.EV_ ## X
+#endif /* defined(__STDC__) || defined(__cplusplus) */
 
 #endif  tp_NSTATES 
 #endif KERNEL
 
 #endif  tp_NSTATES 
 #endif KERNEL