diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-14 02:01:46 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-17 00:56:35 +0200 |
commit | c44f5faa8e8c2036da2ba656f79b57a737543aff (patch) | |
tree | 01077e73629b4adeff0f7b05d5cca2cdde4cca59 /net/netfilter | |
parent | 58618115492711d99fbccb79c5317299e32231fe (diff) | |
download | linux-stable-c44f5faa8e8c2036da2ba656f79b57a737543aff.tar.gz linux-stable-c44f5faa8e8c2036da2ba656f79b57a737543aff.tar.bz2 linux-stable-c44f5faa8e8c2036da2ba656f79b57a737543aff.zip |
netfilter: xt_HMARK: modulus is expensive for hash calculation
Use:
((u64)(HASH_VAL * HASH_SIZE)) >> 32
as suggested by David S. Miller.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/xt_HMARK.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/xt_HMARK.c b/net/netfilter/xt_HMARK.c index 5817d03105b2..0a96a43108ed 100644 --- a/net/netfilter/xt_HMARK.c +++ b/net/netfilter/xt_HMARK.c @@ -109,7 +109,7 @@ hmark_hash(struct hmark_tuple *t, const struct xt_hmark_info *info) hash = jhash_3words(t->src, t->dst, t->uports.v32, info->hashrnd); hash = hash ^ (t->proto & info->proto_mask); - return (hash % info->hmodulus) + info->hoffset; + return (((u64)hash * info->hmodulus) >> 32) + info->hoffset; } static void |