]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/tcp_timer.h
xnu-2422.100.13.tar.gz
[apple/xnu.git] / bsd / netinet / tcp_timer.h
index df1162053f2e7ef1db26a6e501feedc1d1bf0815..55f4287076f91cd6e70ef7e5e14d78a29c8c3a8a 100644 (file)
@@ -72,7 +72,7 @@
 /*
  * Definitions of the TCP timers.
  */
-#define        TCPT_NTIMERS    5
+#define        TCPT_NTIMERS    (TCPT_MAX + 1)  
 
 /* Keep the external definition the same for binary compatibility */
 #define TCPT_NTIMERS_EXT       4
 #define        TCPT_KEEP       2               /* keep alive */
 #define        TCPT_2MSL       3               /* 2*msl quiet time timer */
 #define        TCPT_DELACK     4               /* delayed ack timer */
+#if MPTCP
+#define TCPT_JACK_RXMT 5               /* retransmit timer for join ack */
+#define TCPT_MAX       5
+#else /* MPTCP */
 #define        TCPT_MAX        4
+#endif /* !MPTCP */
 #define        TCPT_NONE       (TCPT_MAX + 1)  
 
 /*
 #define TCPTV_UNACKWIN ( TCP_RETRANSHZ/10 )    /* Window for counting rcv bytes to see if 
                                                   ack-stretching can start (default 100 ms) */
 #define TCPTV_MAXRCVIDLE (TCP_RETRANSHZ/5 )    /* Receiver idle time, avoid ack-stretching after that*/
+#define TCPTV_RCVBUFIDLE (TCP_RETRANSHZ/2)     /* Receiver idle time, for rcv socket buffer resizing */
 
 /* No ack stretching during slow-start, until we see some packets.
  * By the time the receiver gets 512 packets, the senders cwnd 
- * should open by a few hundred packets considering the progression
- * during slow-start.
+ * should open by a few hundred packets consdering the 
+ * slow-start progression.
  */
 #define TCP_RCV_SS_PKTCOUNT     512
 
@@ -232,7 +238,7 @@ struct tcptimerlist {
 #define TCPTV_REXMTSLOP ( TCP_RETRANSHZ/5 )    /* rexmt slop allowed (200 ms) */
 
 /* macro to decide when retransmit slop (described above) should be added */
-#define TCP_ADD_REXMTSLOP(tp) ((tp->t_flags & TF_LOCAL) != 0 || tp->t_state >= TCPS_ESTABLISHED) 
+#define TCP_ADD_REXMTSLOP(tp) (tp->t_state >= TCPS_ESTABLISHED) 
 
 #define        TCPT_RANGESET(tv, value, tvmin, tvmax, addslop) do { \
        (tv) = ((addslop) ? tcp_rexmt_slop : 0) + (value); \
@@ -242,14 +248,32 @@ struct tcptimerlist {
                (tv) = (tvmax); \
 } while(0)
 
-#define TCP_KEEPIDLE(tp) \
-       (tp->t_keepidle && (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) ? \
-               tp->t_keepidle : tcp_keepidle)
+#define TCP_CONN_KEEPIDLE(tp) \
+       ((tp)->t_keepidle && \
+       ((tp)->t_inpcb->inp_socket->so_options & SO_KEEPALIVE) ? \
+               (tp)->t_keepidle : tcp_keepidle)
+#define TCP_CONN_KEEPINIT(tp) \
+       (((tp)->t_keepinit > 0) ? (tp)->t_keepinit : tcp_keepinit)
+#define TCP_CONN_KEEPCNT(tp) \
+       (((tp)->t_keepcnt > 0) ? (tp)->t_keepcnt : tcp_keepcnt)
+#define TCP_CONN_KEEPINTVL(tp) \
+       (((tp)->t_keepintvl > 0) ? (tp)->t_keepintvl : tcp_keepintvl)
+#define TCP_CONN_MAXIDLE(tp) \
+       (TCP_CONN_KEEPCNT(tp) * TCP_CONN_KEEPINTVL(tp))
+
+/* Since we did not add rexmt slop for local connections, we should add
+ * it to idle timeout. Otherwise local connections will reach idle state
+ * quickly
+ */
+#define TCP_IDLETIMEOUT(tp) \
+       (((TCP_ADD_REXMTSLOP(tp)) ? 0 : tcp_rexmt_slop) + tp->t_rxtcur)
+
+TAILQ_HEAD(tcptailq, tcpcb);
 
 extern int tcp_keepinit;               /* time to establish connection */
 extern int tcp_keepidle;               /* time before keepalive probes begin */
 extern int tcp_keepintvl;              /* time between keepalive probes */
-extern int tcp_maxidle;                        /* time to drop after starting probes */
+extern int tcp_keepcnt;                        /* number of keepalives */
 extern int tcp_delack;                 /* delayed ack timer */
 extern int tcp_maxpersistidle;
 extern int tcp_msl;