xfrm: use complete IPv6 addresses for hash
authorMichal Kubecek <mkubecek@suse.cz>
Fri, 12 Oct 2018 12:24:44 +0000 (14:24 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 15 Oct 2018 08:09:18 +0000 (10:09 +0200)
commit8d4b6bce2559755cf2db6513a267fccdfbf7c3ab
tree67e95350ad40c9474764892ee84af863bd805f07
parentf1193e915748291fb205a908db33bd3debece6e2
xfrm: use complete IPv6 addresses for hash

In some environments it is common that many hosts share the same lower half
of their IPv6 addresses (in particular ::1). As __xfrm6_addr_hash() and
__xfrm6_daddr_saddr_hash() calculate the hash only from the lower halves,
as much as 1/3 of the hosts ends up in one hashtable chain which harms the
performance.

Use complete IPv6 addresses when calculating the hashes. Rather than just
adding two more words to the xor, use jhash2() for consistency with
__xfrm6_pref_hash() and __xfrm6_dpref_spref_hash().

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_hash.h