Do not delay a new ack if there already is a delayed ack pending on the

connection, but send it immediately.  Prior to this change, it was possible
to delay a delayed-ack for multiple times, resulting in degraded TCP
behavior in certain corner cases.
This commit is contained in:
Jonathan Lemon 2001-02-25 15:17:24 +00:00
parent b94193dfc1
commit d8c85a260f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=73031
2 changed files with 22 additions and 10 deletions

View File

@ -164,6 +164,12 @@ do { \
#define ND6_HINT(tp)
#endif
/*
* Indicate whether this ack should be delayed.
*/
#define DELAY_ACK(tp) \
(tcp_delack_enabled && !callout_pending(tp->tt_delack))
/*
* Insert segment which inludes th into reassembly queue of tcp with
* control block tp. Return TH_FIN if reassembly now includes
@ -178,7 +184,7 @@ do { \
if ((th)->th_seq == (tp)->rcv_nxt && \
LIST_EMPTY(&(tp)->t_segq) && \
(tp)->t_state == TCPS_ESTABLISHED) { \
if (tcp_delack_enabled) \
if (DELAY_ACK(tp)) \
callout_reset(tp->tt_delack, tcp_delacktime, \
tcp_timer_delack, tp); \
else \
@ -968,7 +974,7 @@ tcp_input(m, off0, proto)
m_adj(m, drop_hdrlen); /* delayed header drop */
sbappend(&so->so_rcv, m);
sorwakeup(so);
if (tcp_delack_enabled) {
if (DELAY_ACK(tp)) {
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
} else {
@ -1153,7 +1159,7 @@ tcp_input(m, off0, proto)
* segment. Otherwise must send ACK now in case
* the other side is slow starting.
*/
if (tcp_delack_enabled && ((thflags & TH_FIN) ||
if (DELAY_ACK(tp) && ((thflags & TH_FIN) ||
(tlen != 0 &&
#ifdef INET6
((isipv6 && in6_localaddr(&inp->in6p_faddr))
@ -1304,7 +1310,7 @@ tcp_input(m, off0, proto)
* If there's data, delay ACK; if there's also a FIN
* ACKNOW will be turned on later.
*/
if (tcp_delack_enabled && tlen != 0)
if (DELAY_ACK(tp) && tlen != 0)
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
else
@ -2170,7 +2176,7 @@ tcp_input(m, off0, proto)
* Otherwise, since we received a FIN then no
* more input can be expected, send ACK now.
*/
if (tcp_delack_enabled && (tp->t_flags & TF_NEEDSYN))
if (DELAY_ACK(tp) && (tp->t_flags & TF_NEEDSYN))
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
else

View File

@ -164,6 +164,12 @@ do { \
#define ND6_HINT(tp)
#endif
/*
* Indicate whether this ack should be delayed.
*/
#define DELAY_ACK(tp) \
(tcp_delack_enabled && !callout_pending(tp->tt_delack))
/*
* Insert segment which inludes th into reassembly queue of tcp with
* control block tp. Return TH_FIN if reassembly now includes
@ -178,7 +184,7 @@ do { \
if ((th)->th_seq == (tp)->rcv_nxt && \
LIST_EMPTY(&(tp)->t_segq) && \
(tp)->t_state == TCPS_ESTABLISHED) { \
if (tcp_delack_enabled) \
if (DELAY_ACK(tp)) \
callout_reset(tp->tt_delack, tcp_delacktime, \
tcp_timer_delack, tp); \
else \
@ -968,7 +974,7 @@ tcp_input(m, off0, proto)
m_adj(m, drop_hdrlen); /* delayed header drop */
sbappend(&so->so_rcv, m);
sorwakeup(so);
if (tcp_delack_enabled) {
if (DELAY_ACK(tp)) {
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
} else {
@ -1153,7 +1159,7 @@ tcp_input(m, off0, proto)
* segment. Otherwise must send ACK now in case
* the other side is slow starting.
*/
if (tcp_delack_enabled && ((thflags & TH_FIN) ||
if (DELAY_ACK(tp) && ((thflags & TH_FIN) ||
(tlen != 0 &&
#ifdef INET6
((isipv6 && in6_localaddr(&inp->in6p_faddr))
@ -1304,7 +1310,7 @@ tcp_input(m, off0, proto)
* If there's data, delay ACK; if there's also a FIN
* ACKNOW will be turned on later.
*/
if (tcp_delack_enabled && tlen != 0)
if (DELAY_ACK(tp) && tlen != 0)
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
else
@ -2170,7 +2176,7 @@ tcp_input(m, off0, proto)
* Otherwise, since we received a FIN then no
* more input can be expected, send ACK now.
*/
if (tcp_delack_enabled && (tp->t_flags & TF_NEEDSYN))
if (DELAY_ACK(tp) && (tp->t_flags & TF_NEEDSYN))
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
else