Commit c44f5faa authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

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: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 58618115
...@@ -109,7 +109,7 @@ hmark_hash(struct hmark_tuple *t, const struct xt_hmark_info *info) ...@@ -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 = jhash_3words(t->src, t->dst, t->uports.v32, info->hashrnd);
hash = hash ^ (t->proto & info->proto_mask); hash = hash ^ (t->proto & info->proto_mask);
return (hash % info->hmodulus) + info->hoffset; return (((u64)hash * info->hmodulus) >> 32) + info->hoffset;
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment