Lines Matching refs:table

10 static struct hlist_head *pubkey_bucket(struct pubkey_hashtable *table,
17 const u64 hash = siphash(pubkey, NOISE_PUBLIC_KEY_LEN, &table->key);
19 return &table->hashtable[hash & (HASH_SIZE(table->hashtable) - 1)];
24 struct pubkey_hashtable *table = kvmalloc(sizeof(*table), GFP_KERNEL);
26 if (!table)
29 get_random_bytes(&table->key, sizeof(table->key));
30 hash_init(table->hashtable);
31 mutex_init(&table->lock);
32 return table;
35 void wg_pubkey_hashtable_add(struct pubkey_hashtable *table,
38 mutex_lock(&table->lock);
40 pubkey_bucket(table, peer->handshake.remote_static));
41 mutex_unlock(&table->lock);
44 void wg_pubkey_hashtable_remove(struct pubkey_hashtable *table,
47 mutex_lock(&table->lock);
49 mutex_unlock(&table->lock);
54 wg_pubkey_hashtable_lookup(struct pubkey_hashtable *table,
60 hlist_for_each_entry_rcu_bh(iter_peer, pubkey_bucket(table, pubkey),
73 static struct hlist_head *index_bucket(struct index_hashtable *table,
79 return &table->hashtable[(__force u32)index &
80 (HASH_SIZE(table->hashtable) - 1)];
85 struct index_hashtable *table = kvmalloc(sizeof(*table), GFP_KERNEL);
87 if (!table)
90 hash_init(table->hashtable);
91 spin_lock_init(&table->lock);
92 return table;
119 __le32 wg_index_hashtable_insert(struct index_hashtable *table,
124 spin_lock_bh(&table->lock);
126 spin_unlock_bh(&table->lock);
134 index_bucket(table, entry->index),
144 spin_lock_bh(&table->lock);
146 index_bucket(table, entry->index),
149 spin_unlock_bh(&table->lock);
158 index_bucket(table, entry->index));
159 spin_unlock_bh(&table->lock);
166 bool wg_index_hashtable_replace(struct index_hashtable *table,
172 spin_lock_bh(&table->lock);
188 spin_unlock_bh(&table->lock);
192 void wg_index_hashtable_remove(struct index_hashtable *table,
195 spin_lock_bh(&table->lock);
197 spin_unlock_bh(&table->lock);
202 wg_index_hashtable_lookup(struct index_hashtable *table,
209 hlist_for_each_entry_rcu_bh(iter_entry, index_bucket(table, index),