diff options
author | dg <dg@FreeBSD.org> | 1997-03-03 09:23:37 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1997-03-03 09:23:37 +0000 |
commit | 1e7a910ca151c2606d05de7a8b9fa8d216282613 (patch) | |
tree | 077e9d6952606940594f8dc5a8bee133d9194994 /sys/netinet/in_pcb.h | |
parent | 43ee6e62202714fbafd263ea7d2b9f482ece532c (diff) | |
download | FreeBSD-src-1e7a910ca151c2606d05de7a8b9fa8d216282613.zip FreeBSD-src-1e7a910ca151c2606d05de7a8b9fa8d216282613.tar.gz |
Improved performance of hash algorithm while (hopefully) not reducing
the quality of the hash distribution. This does not fix a problem dealing
with poor distribution when using lots of IP aliases and listening
on the same port on every one of them...some other day perhaps; fixing
that requires significant code changes.
The use of xor was inspired by David S. Miller <davem@jenolan.rutgers.edu>
Diffstat (limited to 'sys/netinet/in_pcb.h')
-rw-r--r-- | sys/netinet/in_pcb.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 1b416f1..6adad91 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 - * $Id$ + * $Id: in_pcb.h,v 1.18 1997/02/22 09:41:29 peter Exp $ */ #ifndef _NETINET_IN_PCB_H_ @@ -68,12 +68,15 @@ struct inpcb { struct inpcbinfo { struct inpcbhead *listhead; struct inpcbhead *hashbase; - unsigned long hashsize; + unsigned long hashmask; unsigned short lastport; unsigned short lastlow; unsigned short lasthi; }; +#define INP_PCBHASH(faddr, lport, fport, mask) \ + (((faddr) ^ ((faddr) >> 16) ^ (lport) ^ (fport)) & (mask)) + /* flags in inp_flags: */ #define INP_RECVOPTS 0x01 /* receive incoming IP options */ #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ |