Commit c44f5faa8e8c2036da2ba656f79b57a737543aff

Authored by Pablo Neira Ayuso
1 parent 5861811549

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

net/netfilter/xt_HMARK.c
... ... @@ -109,7 +109,7 @@
109 109 hash = jhash_3words(t->src, t->dst, t->uports.v32, info->hashrnd);
110 110 hash = hash ^ (t->proto & info->proto_mask);
111 111  
112   - return (hash % info->hmodulus) + info->hoffset;
  112 + return (((u64)hash * info->hmodulus) >> 32) + info->hoffset;
113 113 }
114 114  
115 115 static void