Implement a queue for delayed ACK processing. This queue is used in

tcp_fasttimo() in lieu of scanning all open TCP connections.
This commit is contained in:
thorpej 1997-12-31 03:31:23 +00:00
parent d6eb3246bf
commit 673fb149c6
5 changed files with 46 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_input.c,v 1.37 1997/12/11 06:33:29 thorpej Exp $ */ /* $NetBSD: tcp_input.c,v 1.38 1997/12/31 03:31:23 thorpej Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994
@ -121,7 +121,7 @@ do { \
(tp)->t_flags & TF_DELACK) \ (tp)->t_flags & TF_DELACK) \
tp->t_flags |= TF_ACKNOW; \ tp->t_flags |= TF_ACKNOW; \
else \ else \
tp->t_flags |= TF_DELACK; \ TCP_SET_DELACK(tp); \
} while (0) } while (0)
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_output.c,v 1.25 1997/12/17 05:59:32 thorpej Exp $ */ /* $NetBSD: tcp_output.c,v 1.26 1997/12/31 03:31:25 thorpej Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1988, 1990, 1993 * Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -642,7 +642,8 @@ out:
if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv)) if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv))
tp->rcv_adv = tp->rcv_nxt + win; tp->rcv_adv = tp->rcv_nxt + win;
tp->last_ack_sent = tp->rcv_nxt; tp->last_ack_sent = tp->rcv_nxt;
tp->t_flags &= ~(TF_ACKNOW|TF_DELACK); tp->t_flags &= ~TF_ACKNOW;
TCP_CLEAR_DELACK(tp);
if (sendalot) if (sendalot)
goto again; goto again;
return (0); return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.36 1997/12/11 22:47:25 thorpej Exp $ */ /* $NetBSD: tcp_subr.c,v 1.37 1997/12/31 03:31:26 thorpej Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1988, 1990, 1993 * Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -88,6 +88,7 @@ tcp_init()
{ {
in_pcbinit(&tcbtable, tcbhashsize, tcbhashsize); in_pcbinit(&tcbtable, tcbhashsize, tcbhashsize);
LIST_INIT(&tcp_delacks);
if (max_protohdr < sizeof(struct tcpiphdr)) if (max_protohdr < sizeof(struct tcpiphdr))
max_protohdr = sizeof(struct tcpiphdr); max_protohdr = sizeof(struct tcpiphdr);
if (max_linkhdr + sizeof(struct tcpiphdr) > MHLEN) if (max_linkhdr + sizeof(struct tcpiphdr) > MHLEN)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_timer.c,v 1.26 1997/12/17 06:04:17 thorpej Exp $ */ /* $NetBSD: tcp_timer.c,v 1.27 1997/12/31 03:31:27 thorpej Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1988, 1990, 1993 * Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -71,26 +71,27 @@ extern int tcp_keepcnt;
extern int tcp_maxpersistidle; extern int tcp_maxpersistidle;
#endif /* TUBA_INCLUDE */ #endif /* TUBA_INCLUDE */
struct tcp_delack_head tcp_delacks;
/* /*
* Fast timeout routine for processing delayed acks * Fast timeout routine for processing delayed acks
*/ */
void void
tcp_fasttimo() tcp_fasttimo()
{ {
register struct inpcb *inp; register struct tcpcb *tp, *ntp;
register struct tcpcb *tp;
int s; int s;
s = splsoftnet(); s = splsoftnet();
inp = tcbtable.inpt_queue.cqh_first; for (tp = tcp_delacks.lh_first; tp != NULL; tp = ntp) {
if (inp) /* XXX */ /*
for (; inp != (struct inpcb *)&tcbtable.inpt_queue; * If tcp_output() can't transmit the ACK for whatever
inp = inp->inp_queue.cqe_next) { * reason, it will remain on the queue for the next
if ((tp = intotcpcb(inp)) != NULL && * time the heartbeat ticks.
(tp->t_flags & TF_DELACK)) { */
tp->t_flags |= TF_ACKNOW; ntp = tp->t_delack.le_next;
(void) tcp_output(tp); tp->t_flags |= TF_ACKNOW;
} (void) tcp_output(tp);
} }
splx(s); splx(s);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_var.h,v 1.31 1997/12/17 06:06:41 thorpej Exp $ */ /* $NetBSD: tcp_var.h,v 1.32 1997/12/31 03:31:29 thorpej Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1993, 1994 * Copyright (c) 1982, 1986, 1993, 1994
@ -67,6 +67,7 @@ struct tcpcb {
struct tcpiphdr *t_template; /* skeletal packet for transmit */ struct tcpiphdr *t_template; /* skeletal packet for transmit */
struct inpcb *t_inpcb; /* back pointer to internet pcb */ struct inpcb *t_inpcb; /* back pointer to internet pcb */
LIST_ENTRY(tcpcb) t_delack; /* delayed ACK queue */
/* /*
* The following fields are used as in the protocol specification. * The following fields are used as in the protocol specification.
* See RFC783, Dec. 1981, page 21. * See RFC783, Dec. 1981, page 21.
@ -131,6 +132,30 @@ struct tcpcb {
caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */ caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */
}; };
/*
* Queue for delayed ACK processing.
*/
LIST_HEAD(tcp_delack_head, tcpcb);
#ifdef _KERNEL
extern struct tcp_delack_head tcp_delacks;
#define TCP_SET_DELACK(tp) \
do { \
if (((tp)->t_flags & TF_DELACK) == 0) { \
(tp)->t_flags |= TF_DELACK; \
LIST_INSERT_HEAD(&tcp_delacks, (tp), t_delack); \
} \
} while (0)
#define TCP_CLEAR_DELACK(tp) \
do { \
if ((tp)->t_flags & TF_DELACK) { \
(tp)->t_flags &= ~TF_DELACK; \
LIST_REMOVE((tp), t_delack); \
} \
} while (0)
#endif /* _KERNEL */
/* /*
* Handy way of passing around TCP option info. * Handy way of passing around TCP option info.
*/ */