diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2002-01-24 22:42:50 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2002-01-24 22:42:50 +0000 |
commit | affebfba7ff72a56240a3f25cf83b7333d676eec (patch) | |
tree | b73060374cd7d4638ca05913a33bbc505583fb5d /sys/netinet/tcp_subr.c | |
parent | 229f438bede61cf09c0e83a91465b8185242836c (diff) |
allocate tcp reassembly queue via pool; based on netbsd; okay art@ angelos@
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 05bc7068064..2416d8bc73f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.56 2002/01/23 00:39:48 art Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.57 2002/01/24 22:42:49 provos Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -148,6 +148,8 @@ struct pool tcpcb_pool; struct pool sackhl_pool; #endif +int tcp_freeq __P((struct tcpcb *)); + struct tcpstat tcpstat; /* tcp statistics */ /* @@ -542,10 +544,8 @@ tcp_drop(tp, errno) * wake up any sleepers */ struct tcpcb * -tcp_close(tp) - register struct tcpcb *tp; +tcp_close(struct tcpcb *tp) { - register struct ipqent *qe; struct inpcb *inp = tp->t_inpcb; struct socket *so = inp->inp_socket; #ifdef TCP_SACK @@ -663,25 +663,8 @@ tcp_close(tp) #endif /* RTV_RTT */ /* free the reassembly queue, if any */ -#ifdef INET6 - /* Reassembling TCP segments in v6 might be sufficiently different - * to merit two codepaths to free the reasssembly queue. - * If an undecided TCP socket, then the IPv4 codepath will be used - * because it won't matter much anyway. - */ - if (tp->pf == AF_INET6) { - while ((qe = tp->segq.lh_first) != NULL) { - LIST_REMOVE(qe, ipqe_q); - m_freem(qe->ipqe_m); - FREE(qe, M_IPQ); - } - } else -#endif /* INET6 */ - while ((qe = tp->segq.lh_first) != NULL) { - LIST_REMOVE(qe, ipqe_q); - m_freem(qe->ipqe_m); - FREE(qe, M_IPQ); - } + tcp_freeq(tp); + #ifdef TCP_SACK /* Free SACK holes. */ q = p = tp->snd_holes; @@ -701,6 +684,21 @@ tcp_close(tp) return ((struct tcpcb *)0); } +int +tcp_freeq(struct tcpcb *tp) +{ + struct ipqent *qe; + int rv = 0; + + while ((qe = LIST_FIRST(&tp->segq)) != NULL) { + LIST_REMOVE(qe, ipqe_q); + m_freem(qe->ipqe_m); + pool_put(&ipqent_pool, qe); + rv = 1; + } + return (rv); +} + void tcp_drain() { |