Lines Matching full:hash
27 #define PERFECT_HASH_THRESHOLD 64 /* use perfect hash if not bigger */
49 struct tcindex_filter_result *perfect; /* perfect hash; NULL if none */
50 struct tcindex_filter __rcu **h; /* imperfect hash; */
54 u32 hash; /* hash table size; 0 if undefined */ member
57 refcount_t refcnt; /* a temporary refcnt for perfect hash */
91 fp = &p->h[key % p->hash]; in tcindex_lookup()
153 p->hash = DEFAULT_HASH_SIZE; in tcindex_init()
213 for (i = 0; i < p->hash; i++) { in tcindex_delete()
261 return p->hash > (p->mask >> p->shift); in valid_perfect_hash()
301 for (i = 0; i < cp->hash; i++) in tcindex_free_perfect_hash()
310 cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result), in tcindex_alloc_perfect_hash()
315 for (i = 0; i < cp->hash; i++) { in tcindex_alloc_perfect_hash()
354 * perfect hash and hash pointers from old data. in tcindex_set_parms()
362 cp->hash = p->hash; in tcindex_set_parms()
369 cp->hash = nla_get_u32(tb[TCA_TCINDEX_HASH]); in tcindex_set_parms()
381 if (!cp->hash) { in tcindex_set_parms()
382 /* Hash not specified, use perfect hash if the upper limit in tcindex_set_parms()
386 cp->hash = (cp->mask >> cp->shift) + 1; in tcindex_set_parms()
388 cp->hash = DEFAULT_HASH_SIZE; in tcindex_set_parms()
396 cp->alloc_hash = cp->hash; in tcindex_set_parms()
397 for (i = 0; i < min(cp->hash, p->hash); i++) in tcindex_set_parms()
411 /* Hash already allocated, make sure that we still meet the in tcindex_set_parms()
412 * requirements for the allocated hash. in tcindex_set_parms()
416 cp->hash > cp->alloc_hash) in tcindex_set_parms()
418 } else if (cp->h && cp->hash != cp->alloc_hash) { in tcindex_set_parms()
427 cp->alloc_hash = cp->hash; in tcindex_set_parms()
446 struct tcindex_filter __rcu **hash; in tcindex_set_parms() local
448 hash = kcalloc(cp->hash, in tcindex_set_parms()
452 if (!hash) in tcindex_set_parms()
455 cp->h = hash; in tcindex_set_parms()
508 fp = cp->h + (handle % cp->hash); in tcindex_set_parms()
528 fp = cp->h + (handle % cp->hash); in tcindex_set_parms()
592 for (i = 0; i < p->hash; i++) { in tcindex_walk()
606 for (i = 0; i < p->hash; i++) { in tcindex_walk()
629 for (i = 0; i < p->hash; i++) { in tcindex_destroy()
635 * here. Imperfect hash does not need this, because it in tcindex_destroy()
649 for (i = 0; p->h && i < p->hash; i++) { in tcindex_destroy()
680 if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) || in tcindex_dump()
695 for (i = 0; !t->tcm_handle && i < p->hash; i++) { in tcindex_dump()