Lines Matching full:hash
26 #define PERFECT_HASH_THRESHOLD 64 /* use perfect hash if not bigger */
48 struct tcindex_filter_result *perfect; /* perfect hash; NULL if none */
49 struct tcindex_filter __rcu **h; /* imperfect hash; */
53 u32 hash; /* hash table size; 0 if undefined */ member
56 refcount_t refcnt; /* a temporary refcnt for perfect hash */
90 fp = &p->h[key % p->hash]; in tcindex_lookup()
152 p->hash = DEFAULT_HASH_SIZE; in tcindex_init()
212 for (i = 0; i < p->hash; i++) { in tcindex_delete()
260 return p->hash > (p->mask >> p->shift); in valid_perfect_hash()
297 for (i = 0; i < cp->hash; i++) in tcindex_free_perfect_hash()
306 cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result), in tcindex_alloc_perfect_hash()
311 for (i = 0; i < cp->hash; i++) { in tcindex_alloc_perfect_hash()
349 * perfect hash and hash pointers from old data. in tcindex_set_parms()
357 cp->hash = p->hash; in tcindex_set_parms()
364 cp->hash = nla_get_u32(tb[TCA_TCINDEX_HASH]); in tcindex_set_parms()
372 if (!cp->hash) { in tcindex_set_parms()
373 /* Hash not specified, use perfect hash if the upper limit in tcindex_set_parms()
377 cp->hash = (cp->mask >> cp->shift) + 1; in tcindex_set_parms()
379 cp->hash = DEFAULT_HASH_SIZE; in tcindex_set_parms()
387 cp->alloc_hash = cp->hash; in tcindex_set_parms()
388 for (i = 0; i < min(cp->hash, p->hash); i++) in tcindex_set_parms()
402 /* Hash already allocated, make sure that we still meet the in tcindex_set_parms()
403 * requirements for the allocated hash. in tcindex_set_parms()
407 cp->hash > cp->alloc_hash) in tcindex_set_parms()
409 } else if (cp->h && cp->hash != cp->alloc_hash) { in tcindex_set_parms()
418 cp->alloc_hash = cp->hash; in tcindex_set_parms()
437 struct tcindex_filter __rcu **hash; in tcindex_set_parms() local
439 hash = kcalloc(cp->hash, in tcindex_set_parms()
443 if (!hash) in tcindex_set_parms()
446 cp->h = hash; in tcindex_set_parms()
495 fp = cp->h + (handle % cp->hash); in tcindex_set_parms()
559 for (i = 0; i < p->hash; i++) { in tcindex_walk()
573 for (i = 0; i < p->hash; i++) { in tcindex_walk()
596 for (i = 0; i < p->hash; i++) { in tcindex_destroy()
602 * here. Imperfect hash does not need this, because it in tcindex_destroy()
616 for (i = 0; p->h && i < p->hash; i++) { in tcindex_destroy()
647 if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) || in tcindex_dump()
662 for (i = 0; !t->tcm_handle && i < p->hash; i++) { in tcindex_dump()