add ssize_t, required by POSIX 1003.1
[unix-history] / usr / src / sys / netiso / tp_param.h
index 1c3531b..2946a28 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.11 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -70,15 +70,19 @@ extern int N_TPREF;
         * wraparound in checksumming
         * (No mtu is likely to be larger than 4K anyway...)
         */
         * wraparound in checksumming
         * (No mtu is likely to be larger than 4K anyway...)
         */
-#define                TP_NRETRANS                     5 /* was 1; cray uses 6 */
+#define                TP_NRETRANS                     12              /* TCP_MAXRXTSHIFT + 1 */
+#define                TP_MAXRXTSHIFT          6               /* factor of 64 */
 #define                TP_MAXPORT                      0xefff
 
 #define                TP_MAXPORT                      0xefff
 
-#define                TP_RTT_NUM                      0x7
 /* ALPHA: to be used in the context: gain= 1/(2**alpha), or 
  * put another way, gaintimes(x) (x)>>alpha (forgetting the case alpha==0) 
  */
 #define        TP_RTT_ALPHA            3 
 #define        TP_RTV_ALPHA            2
 /* ALPHA: to be used in the context: gain= 1/(2**alpha), or 
  * put another way, gaintimes(x) (x)>>alpha (forgetting the case alpha==0) 
  */
 #define        TP_RTT_ALPHA            3 
 #define        TP_RTV_ALPHA            2
+#define                TP_REXMTVAL(tpcb)\
+       ((tp_rttadd + (tpcb)->tp_rtt + ((tpcb)->tp_rtv) << 2) / tp_rttdiv)
+#define                TP_RANGESET(tv, value, min, max) \
+       ((tv = value) > (max) ? (tv = max) : (tv < min ? tv = min : tv))
 
 /*
  * not sure how to treat data on disconnect 
 
 /*
  * not sure how to treat data on disconnect 
@@ -175,6 +179,9 @@ extern int N_TPREF;
 #define                TPP_addl_opt            0xc6
 #define                TPP_alt_class           0xc7
 #define                TPP_perf_meas           0xc8    /* local item : perf meas on, svp */
 #define                TPP_addl_opt            0xc6
 #define                TPP_alt_class           0xc7
 #define                TPP_perf_meas           0xc8    /* local item : perf meas on, svp */
+#define                TPP_ptpdu_size          0xf0    /* preferred TPDU size */
+#define                TPP_inact_time          0xf2    /* inactivity time exchanged */
+
 
 /******************************************************
  * Some fundamental data types
 
 /******************************************************
  * Some fundamental data types
@@ -218,15 +225,6 @@ typedef    unsigned int    SeqNum;
 typedef                unsigned short  RefNum;
 typedef                int                             ProtoHook;
 
 typedef                unsigned short  RefNum;
 typedef                int                             ProtoHook;
 
-
-/******************************************************
- * Some fundamental constants
- *****************************************************/
-
-#define TP_MIN_WIN     2048
-#define TP_MAX_WIN 16384
-#define TP_MAX_WIN_UNPRIV 8192
-
 /******************************************************
  * Macro used all over, for driver
  *****************************************************/
 /******************************************************
  * Macro used all over, for driver
  *****************************************************/
@@ -308,30 +306,34 @@ 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) { if (tpcb->tp_rsycnt == 0) {\
     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) { \
             (tpcb)->tp_lcredit = xxi; \
         } \
     if (!(tpcb->tp_cebit_off)) { \
         (tpcb)->tp_lcredit = ROUND((tpcb)->tp_win_recv); \
         if (xxi < (tpcb)->tp_lcredit) { \
             (tpcb)->tp_lcredit = xxi; \
         } \
-    } \
-    else { \
+    } else \
         (tpcb)->tp_lcredit = xxi; \
         (tpcb)->tp_lcredit = xxi; \
-    } \
-}
+} }
 #endif ARGO_DEBUG
 
 #ifdef KERNEL
 #endif ARGO_DEBUG
 
 #ifdef KERNEL
+extern int tp_rttadd, tp_rttdiv;
+#include "syslog.h"
+#define printf logpri(LOG_DEBUG),addlog
 
 #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