projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5861811
)
netfilter: xt_HMARK: modulus is expensive for hash calculation
author
Pablo Neira Ayuso
<pablo@netfilter.org>
Mon, 14 May 2012 00:01:46 +0000
(
02:01
+0200)
committer
Pablo Neira Ayuso
<pablo@netfilter.org>
Wed, 16 May 2012 22:56:35 +0000
(
00:56
+0200)
Use:
((u64)(HASH_VAL * HASH_SIZE)) >> 32
as suggested by David S. Miller.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_HMARK.c
patch
|
blob
|
blame
|
history
diff --git
a/net/netfilter/xt_HMARK.c
b/net/netfilter/xt_HMARK.c
index 5817d03105b23a35de565c4d31433d6b5232f40a..0a96a43108edde1dcdc251a168f0547c9f277378 100644
(file)
--- 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