Lines Matching refs:hash

45 #include "hash.h"
61 * @data: data to hash
62 * @size: size of the hash table
64 * Return: the hash index of the claim
69 u32 hash = 0;
71 hash = jhash(&claim->addr, sizeof(claim->addr), hash);
72 hash = jhash(&claim->vid, sizeof(claim->vid), hash);
74 return hash % size;
79 * @data: data to hash
80 * @size: size of the hash table
82 * Return: the hash index of the backbone gateway
87 u32 hash = 0;
90 hash = jhash(&gw->orig, sizeof(gw->orig), hash);
91 hash = jhash(&gw->vid, sizeof(gw->vid), hash);
93 return hash % size;
211 * batadv_claim_hash_find() - looks for a claim in the claim hash
221 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
227 if (!hash)
230 index = batadv_choose_claim(data, hash->size);
231 head = &hash->table[index];
250 * batadv_backbone_hash_find() - looks for a backbone gateway in the hash
261 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
267 if (!hash)
273 index = batadv_choose_backbone_gw(&search_entry, hash->size);
274 head = &hash->table[index];
300 struct batadv_hashtable *hash;
305 spinlock_t *list_lock; /* protects write access to the hash lists */
307 hash = backbone_gw->bat_priv->bla.claim_hash;
308 if (!hash)
311 for (i = 0; i < hash->size; i++) {
312 head = &hash->table[i];
313 list_lock = &hash->list_locks[i];
530 /* hash failed, free the structure */
595 struct batadv_hashtable *hash;
610 hash = bat_priv->bla.claim_hash;
611 for (i = 0; i < hash->size; i++) {
612 head = &hash->table[i];
680 * batadv_bla_add_claim() - Adds a claim in the claim hash
715 "%s(): adding new entry %pM, vid %d to hash ...\n",
790 * batadv_bla_del_claim() - delete a claim from the claim hash
817 /* reference from the hash is gone */
1214 * @now: whether the whole hash shall be wiped now
1224 struct batadv_hashtable *hash;
1225 spinlock_t *list_lock; /* protects write access to the hash lists */
1228 hash = bat_priv->bla.backbone_hash;
1229 if (!hash)
1232 for (i = 0; i < hash->size; i++) {
1233 head = &hash->table[i];
1234 list_lock = &hash->list_locks[i];
1267 * @now: whether the whole hash shall be wiped now
1279 struct batadv_hashtable *hash;
1282 hash = bat_priv->bla.claim_hash;
1283 if (!hash)
1286 for (i = 0; i < hash->size; i++) {
1287 head = &hash->table[i];
1334 struct batadv_hashtable *hash;
1352 hash = bat_priv->bla.backbone_hash;
1353 if (!hash)
1356 for (i = 0; i < hash->size; i++) {
1357 head = &hash->table[i];
1432 struct batadv_hashtable *hash;
1466 hash = bat_priv->bla.backbone_hash;
1467 if (!hash)
1470 for (i = 0; i < hash->size; i++) {
1471 head = &hash->table[i];
1513 /* The hash for claim and backbone hash receive the same key because they
1537 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n");
1735 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
1743 if (!hash)
1746 for (i = 0; i < hash->size; i++) {
1747 head = &hash->table[i];
2187 * @hash: hash to dump
2197 struct batadv_hashtable *hash, unsigned int bucket,
2204 spin_lock_bh(&hash->list_locks[bucket]);
2205 cb->seq = atomic_read(&hash->generation) << 1 | 1;
2207 hlist_for_each_entry(claim, &hash->table[bucket], hash_entry) {
2221 spin_unlock_bh(&hash->list_locks[bucket]);
2238 struct batadv_hashtable *hash;
2257 hash = bat_priv->bla.claim_hash;
2265 while (bucket < hash->size) {
2267 hash, bucket, &idx))
2357 * @hash: hash to dump
2367 struct batadv_hashtable *hash,
2374 spin_lock_bh(&hash->list_locks[bucket]);
2375 cb->seq = atomic_read(&hash->generation) << 1 | 1;
2377 hlist_for_each_entry(backbone_gw, &hash->table[bucket], hash_entry) {
2391 spin_unlock_bh(&hash->list_locks[bucket]);
2408 struct batadv_hashtable *hash;
2427 hash = bat_priv->bla.backbone_hash;
2435 while (bucket < hash->size) {
2437 hash, bucket, &idx))