Lines Matching refs:hash

46 #include "hash.h"
62 * @data: data to hash
63 * @size: size of the hash table
65 * Return: the hash index of the claim
70 u32 hash = 0;
72 hash = jhash(&claim->addr, sizeof(claim->addr), hash);
73 hash = jhash(&claim->vid, sizeof(claim->vid), hash);
75 return hash % size;
80 * @data: data to hash
81 * @size: size of the hash table
83 * Return: the hash index of the backbone gateway
88 u32 hash = 0;
91 hash = jhash(&gw->orig, sizeof(gw->orig), hash);
92 hash = jhash(&gw->vid, sizeof(gw->vid), hash);
94 return hash % size;
212 * batadv_claim_hash_find() - looks for a claim in the claim hash
222 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
228 if (!hash)
231 index = batadv_choose_claim(data, hash->size);
232 head = &hash->table[index];
251 * batadv_backbone_hash_find() - looks for a backbone gateway in the hash
262 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
268 if (!hash)
274 index = batadv_choose_backbone_gw(&search_entry, hash->size);
275 head = &hash->table[index];
301 struct batadv_hashtable *hash;
306 spinlock_t *list_lock; /* protects write access to the hash lists */
308 hash = backbone_gw->bat_priv->bla.claim_hash;
309 if (!hash)
312 for (i = 0; i < hash->size; i++) {
313 head = &hash->table[i];
314 list_lock = &hash->list_locks[i];
535 /* hash failed, free the structure */
600 struct batadv_hashtable *hash;
615 hash = bat_priv->bla.claim_hash;
616 for (i = 0; i < hash->size; i++) {
617 head = &hash->table[i];
685 * batadv_bla_add_claim() - Adds a claim in the claim hash
720 "%s(): adding new entry %pM, vid %d to hash ...\n",
795 * batadv_bla_del_claim() - delete a claim from the claim hash
822 /* reference from the hash is gone */
1219 * @now: whether the whole hash shall be wiped now
1229 struct batadv_hashtable *hash;
1230 spinlock_t *list_lock; /* protects write access to the hash lists */
1233 hash = bat_priv->bla.backbone_hash;
1234 if (!hash)
1237 for (i = 0; i < hash->size; i++) {
1238 head = &hash->table[i];
1239 list_lock = &hash->list_locks[i];
1272 * @now: whether the whole hash shall be wiped now
1284 struct batadv_hashtable *hash;
1287 hash = bat_priv->bla.claim_hash;
1288 if (!hash)
1291 for (i = 0; i < hash->size; i++) {
1292 head = &hash->table[i];
1339 struct batadv_hashtable *hash;
1357 hash = bat_priv->bla.backbone_hash;
1358 if (!hash)
1361 for (i = 0; i < hash->size; i++) {
1362 head = &hash->table[i];
1437 struct batadv_hashtable *hash;
1471 hash = bat_priv->bla.backbone_hash;
1472 if (!hash)
1475 for (i = 0; i < hash->size; i++) {
1476 head = &hash->table[i];
1519 /* The hash for claim and backbone hash receive the same key because they
1543 batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n");
1741 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
1749 if (!hash)
1752 for (i = 0; i < hash->size; i++) {
1753 head = &hash->table[i];
2140 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
2161 for (i = 0; i < hash->size; i++) {
2162 head = &hash->table[i];
2261 * @hash: hash to dump
2271 struct batadv_hashtable *hash, unsigned int bucket,
2278 spin_lock_bh(&hash->list_locks[bucket]);
2279 cb->seq = atomic_read(&hash->generation) << 1 | 1;
2281 hlist_for_each_entry(claim, &hash->table[bucket], hash_entry) {
2295 spin_unlock_bh(&hash->list_locks[bucket]);
2312 struct batadv_hashtable *hash;
2331 hash = bat_priv->bla.claim_hash;
2339 while (bucket < hash->size) {
2341 hash, bucket, &idx))
2374 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
2394 for (i = 0; i < hash->size; i++) {
2395 head = &hash->table[i];
2499 * @hash: hash to dump
2509 struct batadv_hashtable *hash,
2516 spin_lock_bh(&hash->list_locks[bucket]);
2517 cb->seq = atomic_read(&hash->generation) << 1 | 1;
2519 hlist_for_each_entry(backbone_gw, &hash->table[bucket], hash_entry) {
2533 spin_unlock_bh(&hash->list_locks[bucket]);
2550 struct batadv_hashtable *hash;
2569 hash = bat_priv->bla.backbone_hash;
2577 while (bucket < hash->size) {
2579 hash, bucket, &idx))