Lines Matching refs:hash
45 #include "hash.h"
162 spinlock_t *list_lock; /* protects write access to the hash lists */
168 if (!bat_priv->dat.hash)
171 for (i = 0; i < bat_priv->dat.hash->size; i++) {
172 head = &bat_priv->dat.hash->table[i];
173 list_lock = &bat_priv->dat.hash->list_locks[i];
193 * DAT hash table
211 * batadv_compare_dat() - comparing function used in the local DAT hash table
281 * batadv_hash_dat() - compute the hash value for an IP address
282 * @data: data to hash
283 * @size: size of the hash table
285 * Return: the selected index in the hash table for the given data.
289 u32 hash = 0;
297 hash += key[i];
298 hash += (hash << 10);
299 hash ^= (hash >> 6);
305 hash += key[i];
306 hash += (hash << 10);
307 hash ^= (hash >> 6);
310 hash += (hash << 3);
311 hash ^= (hash >> 11);
312 hash += (hash << 15);
314 return hash % size;
318 * batadv_dat_entry_hash_find() - look for a given dat_entry in the local hash
332 struct batadv_hashtable *hash = bat_priv->dat.hash;
335 if (!hash)
341 index = batadv_hash_dat(&to_find, hash->size);
342 head = &hash->table[index];
397 hash_added = batadv_hash_add(bat_priv->dat.hash, batadv_compare_dat,
402 /* remove the reference for the hash */
541 /* this is an hash collision with the temporary selected node. Choose
569 struct batadv_hashtable *hash = bat_priv->orig_hash;
581 for (i = 0; i < hash->size; i++) {
582 head = &hash->table[i];
625 * closest values (from the LEFT, with wrap around if needed) then the hash
653 "%s(): IP=%pI4 hash(IP)=%u\n", __func__, &ip_dst,
793 * batadv_dat_hash_free() - free the local DAT hash table
798 if (!bat_priv->dat.hash)
803 batadv_hash_destroy(bat_priv->dat.hash);
805 bat_priv->dat.hash = NULL;
816 if (bat_priv->dat.hash)
819 bat_priv->dat.hash = batadv_hash_new(1024);
821 if (!bat_priv->dat.hash)
850 * batadv_dat_cache_seq_print_text() - print the local DAT hash table
860 struct batadv_hashtable *hash = bat_priv->dat.hash;
876 for (i = 0; i < hash->size; i++) {
877 head = &hash->table[i];
950 * @hash: hash to dump
959 struct batadv_hashtable *hash, unsigned int bucket,
965 spin_lock_bh(&hash->list_locks[bucket]);
966 cb->seq = atomic_read(&hash->generation) << 1 | 1;
968 hlist_for_each_entry(dat_entry, &hash->table[bucket], hash_entry) {
973 spin_unlock_bh(&hash->list_locks[bucket]);
982 spin_unlock_bh(&hash->list_locks[bucket]);
1000 struct batadv_hashtable *hash;
1019 hash = bat_priv->dat.hash;
1027 while (bucket < hash->size) {
1028 if (batadv_dat_cache_dump_bucket(msg, portid, cb, hash, bucket,