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()
300 for (i = 0; i < cp->hash; i++) in tcindex_free_perfect_hash()
309 cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result), in tcindex_alloc_perfect_hash()
314 for (i = 0; i < cp->hash; i++) { in tcindex_alloc_perfect_hash()
352 * perfect hash and hash pointers from old data. in tcindex_set_parms()
360 cp->hash = p->hash; in tcindex_set_parms()
367 cp->hash = nla_get_u32(tb[TCA_TCINDEX_HASH]); in tcindex_set_parms()
379 if (!cp->hash) { in tcindex_set_parms()
380 /* Hash not specified, use perfect hash if the upper limit in tcindex_set_parms()
384 cp->hash = (cp->mask >> cp->shift) + 1; in tcindex_set_parms()
386 cp->hash = DEFAULT_HASH_SIZE; in tcindex_set_parms()
394 cp->alloc_hash = cp->hash; in tcindex_set_parms()
395 for (i = 0; i < min(cp->hash, p->hash); i++) in tcindex_set_parms()
409 /* Hash already allocated, make sure that we still meet the in tcindex_set_parms()
410 * requirements for the allocated hash. in tcindex_set_parms()
414 cp->hash > cp->alloc_hash) in tcindex_set_parms()
416 } else if (cp->h && cp->hash != cp->alloc_hash) { in tcindex_set_parms()
425 cp->alloc_hash = cp->hash; in tcindex_set_parms()
444 struct tcindex_filter __rcu **hash; in tcindex_set_parms() local
446 hash = kcalloc(cp->hash, in tcindex_set_parms()
450 if (!hash) in tcindex_set_parms()
453 cp->h = hash; in tcindex_set_parms()
502 fp = cp->h + (handle % cp->hash); in tcindex_set_parms()
566 for (i = 0; i < p->hash; i++) { in tcindex_walk()
580 for (i = 0; i < p->hash; i++) { in tcindex_walk()
603 for (i = 0; i < p->hash; i++) { in tcindex_destroy()
609 * here. Imperfect hash does not need this, because it in tcindex_destroy()
623 for (i = 0; p->h && i < p->hash; i++) { in tcindex_destroy()
654 if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) || in tcindex_dump()
669 for (i = 0; !t->tcm_handle && i < p->hash; i++) { in tcindex_dump()