diff options
author | dg <dg@FreeBSD.org> | 1995-04-09 01:29:31 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-04-09 01:29:31 +0000 |
commit | 919fdebd0e121a9cf0b773da1b2886e1d0b05b56 (patch) | |
tree | e79f945463f3979c08d227856c89070dadbf446b /sys/netinet/tcp_timewait.c | |
parent | cc2a98d4eb3f7c92285a86b6d88ddd139e5e323e (diff) | |
download | FreeBSD-src-919fdebd0e121a9cf0b773da1b2886e1d0b05b56.zip FreeBSD-src-919fdebd0e121a9cf0b773da1b2886e1d0b05b56.tar.gz |
Implemented PCB hashing. Includes new functions in_pcbinshash, in_pcbrehash,
and in_pcblookuphash.
Diffstat (limited to 'sys/netinet/tcp_timewait.c')
-rw-r--r-- | sys/netinet/tcp_timewait.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index fbbff78..ea68652 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_subr.c 8.1 (Berkeley) 6/10/93 - * $Id: tcp_subr.c,v 1.8 1995/03/06 02:49:24 nate Exp $ + * $Id: tcp_subr.c,v 1.9 1995/03/16 18:15:05 bde Exp $ */ #include <sys/param.h> @@ -43,6 +43,7 @@ #include <sys/socketvar.h> #include <sys/protosw.h> #include <sys/errno.h> +#include <sys/queue.h> #include <net/route.h> #include <net/if.h> @@ -71,7 +72,13 @@ int tcp_do_rfc1323 = 1; int tcp_do_rfc1644 = 1; static void tcp_cleartaocache(void); -extern struct inpcb *tcp_last_inpcb; +/* + * Target size of TCP PCB hash table. Will be rounded down to a prime + * number. + */ +#ifndef TCBHASHSIZE +#define TCBHASHSIZE 128 +#endif /* * Tcp initialization @@ -83,7 +90,9 @@ tcp_init() tcp_iss = 1; /* wrong */ tcp_ccgen = 1; tcp_cleartaocache(); - tcb.inp_next = tcb.inp_prev = &tcb; + LIST_INIT(&tcb); + tcbinfo.listhead = &tcb; + tcbinfo.hashbase = phashinit(TCBHASHSIZE, M_PCB, &tcbinfo.hashsize); if (max_protohdr < sizeof(struct tcpiphdr)) max_protohdr = sizeof(struct tcpiphdr); if (max_linkhdr + sizeof(struct tcpiphdr) > MHLEN) @@ -373,9 +382,6 @@ tcp_close(tp) free(tp, M_PCB); inp->inp_ppcb = 0; soisdisconnected(so); - /* clobber input pcb cache if we're closing the cached connection */ - if (inp == tcp_last_inpcb) - tcp_last_inpcb = &tcb; in_pcbdetach(inp); tcpstat.tcps_closed++; return ((struct tcpcb *)0); |