/kernel/linux/linux-5.10/samples/bpf/ |
H A D | hash_func01.h | 3 * Based on Paul Hsieh's (LGPG 2.1) hash function 4 * From: http://www.azillionmonkeys.com/qed/hash.html 11 __u32 hash = initval; in SuperFastHash() local 23 hash += get16bits (data); in SuperFastHash() 24 tmp = (get16bits (data+2) << 11) ^ hash; in SuperFastHash() 25 hash = (hash << 16) ^ tmp; in SuperFastHash() 27 hash += hash >> 11; in SuperFastHash() 32 case 3: hash in SuperFastHash() [all...] |
/kernel/linux/linux-6.6/samples/bpf/ |
H A D | hash_func01.h | 3 * Based on Paul Hsieh's (LGPG 2.1) hash function 4 * From: http://www.azillionmonkeys.com/qed/hash.html 11 __u32 hash = initval; in SuperFastHash() local 23 hash += get16bits (data); in SuperFastHash() 24 tmp = (get16bits (data+2) << 11) ^ hash; in SuperFastHash() 25 hash = (hash << 16) ^ tmp; in SuperFastHash() 27 hash += hash >> 11; in SuperFastHash() 32 case 3: hash in SuperFastHash() [all...] |
/kernel/linux/linux-5.10/net/batman-adv/ |
H A D | hash.c | 7 #include "hash.h" 14 /* clears the hash */ 15 static void batadv_hash_init(struct batadv_hashtable *hash) in batadv_hash_init() argument 19 for (i = 0; i < hash->size; i++) { in batadv_hash_init() 20 INIT_HLIST_HEAD(&hash->table[i]); in batadv_hash_init() 21 spin_lock_init(&hash->list_locks[i]); in batadv_hash_init() 24 atomic_set(&hash->generation, 0); in batadv_hash_init() 28 * batadv_hash_destroy() - Free only the hashtable and the hash itself 29 * @hash: hash objec 31 batadv_hash_destroy(struct batadv_hashtable *hash) batadv_hash_destroy() argument 46 struct batadv_hashtable *hash; batadv_hash_new() local 77 batadv_hash_set_lock_class(struct batadv_hashtable *hash, struct lock_class_key *key) batadv_hash_set_lock_class() argument [all...] |
H A D | hash.h | 44 /** @list_locks: spinlock for each hash list entry */ 54 /* allocates and clears the hash */ 58 void batadv_hash_set_lock_class(struct batadv_hashtable *hash, 61 /* free only the hashtable and the hash itself. */ 62 void batadv_hash_destroy(struct batadv_hashtable *hash); 66 * @hash: storage hash table 67 * @compare: callback to determine if 2 hash elements are identical 68 * @choose: callback calculating the hash index 72 * Return: 0 on success, 1 if the element already is in the hash 75 batadv_hash_add(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, const void *data, struct hlist_node *data_node) batadv_hash_add() argument 129 batadv_hash_remove(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, void *data) batadv_hash_remove() argument [all...] |
/kernel/linux/linux-6.6/net/batman-adv/ |
H A D | hash.c | 7 #include "hash.h" 14 /* clears the hash */ 15 static void batadv_hash_init(struct batadv_hashtable *hash) in batadv_hash_init() argument 19 for (i = 0; i < hash->size; i++) { in batadv_hash_init() 20 INIT_HLIST_HEAD(&hash->table[i]); in batadv_hash_init() 21 spin_lock_init(&hash->list_locks[i]); in batadv_hash_init() 24 atomic_set(&hash->generation, 0); in batadv_hash_init() 28 * batadv_hash_destroy() - Free only the hashtable and the hash itself 29 * @hash: hash objec 31 batadv_hash_destroy(struct batadv_hashtable *hash) batadv_hash_destroy() argument 46 struct batadv_hashtable *hash; batadv_hash_new() local 77 batadv_hash_set_lock_class(struct batadv_hashtable *hash, struct lock_class_key *key) batadv_hash_set_lock_class() argument [all...] |
H A D | hash.h | 44 /** @list_locks: spinlock for each hash list entry */ 54 /* allocates and clears the hash */ 58 void batadv_hash_set_lock_class(struct batadv_hashtable *hash, 61 /* free only the hashtable and the hash itself. */ 62 void batadv_hash_destroy(struct batadv_hashtable *hash); 66 * @hash: storage hash table 67 * @compare: callback to determine if 2 hash elements are identical 68 * @choose: callback calculating the hash index 72 * Return: 0 on success, 1 if the element already is in the hash 75 batadv_hash_add(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, const void *data, struct hlist_node *data_node) batadv_hash_add() argument 129 batadv_hash_remove(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, void *data) batadv_hash_remove() argument [all...] |
/kernel/linux/linux-5.10/net/ceph/crush/ |
H A D | hash.c | 3 # include <linux/crush/hash.h> 5 # include "hash.h" 10 * https://burtleburtle.net/bob/hash/evahash.html 29 __u32 hash = crush_hash_seed ^ a; in crush_hash32_rjenkins1() local 33 crush_hashmix(b, x, hash); in crush_hash32_rjenkins1() 34 crush_hashmix(y, a, hash); in crush_hash32_rjenkins1() 35 return hash; in crush_hash32_rjenkins1() 40 __u32 hash = crush_hash_seed ^ a ^ b; in crush_hash32_rjenkins1_2() local 43 crush_hashmix(a, b, hash); in crush_hash32_rjenkins1_2() 44 crush_hashmix(x, a, hash); in crush_hash32_rjenkins1_2() 51 __u32 hash = crush_hash_seed ^ a ^ b ^ c; crush_hash32_rjenkins1_3() local 64 __u32 hash = crush_hash_seed ^ a ^ b ^ c ^ d; crush_hash32_rjenkins1_4() local 79 __u32 hash = crush_hash_seed ^ a ^ b ^ c ^ d ^ e; crush_hash32_rjenkins1_5() local [all...] |
/kernel/linux/linux-6.6/net/ceph/crush/ |
H A D | hash.c | 3 # include <linux/crush/hash.h> 5 # include "hash.h" 10 * https://burtleburtle.net/bob/hash/evahash.html 29 __u32 hash = crush_hash_seed ^ a; in crush_hash32_rjenkins1() local 33 crush_hashmix(b, x, hash); in crush_hash32_rjenkins1() 34 crush_hashmix(y, a, hash); in crush_hash32_rjenkins1() 35 return hash; in crush_hash32_rjenkins1() 40 __u32 hash = crush_hash_seed ^ a ^ b; in crush_hash32_rjenkins1_2() local 43 crush_hashmix(a, b, hash); in crush_hash32_rjenkins1_2() 44 crush_hashmix(x, a, hash); in crush_hash32_rjenkins1_2() 51 __u32 hash = crush_hash_seed ^ a ^ b ^ c; crush_hash32_rjenkins1_3() local 64 __u32 hash = crush_hash_seed ^ a ^ b ^ c ^ d; crush_hash32_rjenkins1_4() local 79 __u32 hash = crush_hash_seed ^ a ^ b ^ c ^ d ^ e; crush_hash32_rjenkins1_5() local [all...] |
/kernel/linux/linux-5.10/drivers/net/xen-netback/ |
H A D | hash.c | 50 spin_lock_irqsave(&vif->hash.cache.lock, flags); in xenvif_add_hash() 54 list_for_each_entry_rcu(entry, &vif->hash.cache.list, link, in xenvif_add_hash() 55 lockdep_is_held(&vif->hash.cache.lock)) { in xenvif_add_hash() 65 new->seq = atomic_inc_return(&vif->hash.cache.seq); in xenvif_add_hash() 66 list_add_rcu(&new->link, &vif->hash.cache.list); in xenvif_add_hash() 68 if (++vif->hash.cache.count > xenvif_hash_cache_size) { in xenvif_add_hash() 70 vif->hash.cache.count--; in xenvif_add_hash() 75 spin_unlock_irqrestore(&vif->hash.cache.lock, flags); in xenvif_add_hash() 86 val = xen_netif_toeplitz_hash(vif->hash.key, in xenvif_new_hash() 87 sizeof(vif->hash in xenvif_new_hash() 154 u32 hash = 0; xenvif_set_skb_hash() local [all...] |
/kernel/linux/linux-6.6/drivers/net/xen-netback/ |
H A D | hash.c | 50 spin_lock_irqsave(&vif->hash.cache.lock, flags); in xenvif_add_hash() 54 list_for_each_entry_rcu(entry, &vif->hash.cache.list, link, in xenvif_add_hash() 55 lockdep_is_held(&vif->hash.cache.lock)) { in xenvif_add_hash() 65 new->seq = atomic_inc_return(&vif->hash.cache.seq); in xenvif_add_hash() 66 list_add_rcu(&new->link, &vif->hash.cache.list); in xenvif_add_hash() 68 if (++vif->hash.cache.count > xenvif_hash_cache_size) { in xenvif_add_hash() 70 vif->hash.cache.count--; in xenvif_add_hash() 75 spin_unlock_irqrestore(&vif->hash.cache.lock, flags); in xenvif_add_hash() 86 val = xen_netif_toeplitz_hash(vif->hash.key, in xenvif_new_hash() 87 sizeof(vif->hash in xenvif_new_hash() 154 u32 hash = 0; xenvif_set_skb_hash() local [all...] |
/kernel/linux/linux-5.10/include/linux/ |
H A D | rhashtable.h | 32 * which is linked into as hash chain from the hash table - or one 33 * of two or more hash tables when the rhashtable is being resized. 36 * the hash bucket. This allows us to be sure we've found the end 38 * The value stored in the hash bucket has BIT(0) used as a lock bit. 51 * The maximum (not average) chain length grows with the size of the hash 54 * The value of 16 is selected so that even if the hash table grew to 65 * struct bucket_table - Table of hash buckets 66 * @size: Number of hash buckets 69 * @hash_rnd: Random seed to fold into hash 119 rht_bucket_index(const struct bucket_table *tbl, unsigned int hash) rht_bucket_index() argument 129 unsigned int hash; rht_key_get_hash() local 159 unsigned int hash = rht_key_get_hash(ht, key, params, tbl->hash_rnd); rht_key_hashfn() local 235 lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash) lockdep_rht_bucket_is_held() argument 286 rht_bucket( const struct bucket_table *tbl, unsigned int hash) rht_bucket() argument 293 rht_bucket_var( struct bucket_table *tbl, unsigned int hash) rht_bucket_var() argument 300 rht_bucket_insert( struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) rht_bucket_insert() argument 372 rht_ptr( struct rhash_lock_head __rcu *const *bkt, struct bucket_table *tbl, unsigned int hash) rht_ptr() argument 592 unsigned int hash; __rhashtable_lookup() local 709 unsigned int hash; __rhashtable_insert_fast() local 994 unsigned int hash; __rhashtable_remove_fast_one() local 1146 unsigned int hash; __rhashtable_replace_fast() local [all...] |
/kernel/linux/linux-6.6/include/linux/ |
H A D | rhashtable.h | 32 * which is linked into as hash chain from the hash table - or one 33 * of two or more hash tables when the rhashtable is being resized. 36 * the hash bucket. This allows us to be sure we've found the end 38 * The value stored in the hash bucket has BIT(0) used as a lock bit. 51 * The maximum (not average) chain length grows with the size of the hash 54 * The value of 16 is selected so that even if the hash table grew to 65 * struct bucket_table - Table of hash buckets 66 * @size: Number of hash buckets 69 * @hash_rnd: Random seed to fold into hash 119 rht_bucket_index(const struct bucket_table *tbl, unsigned int hash) rht_bucket_index() argument 129 unsigned int hash; rht_key_get_hash() local 159 unsigned int hash = rht_key_get_hash(ht, key, params, tbl->hash_rnd); rht_key_hashfn() local 235 lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash) lockdep_rht_bucket_is_held() argument 286 rht_bucket( const struct bucket_table *tbl, unsigned int hash) rht_bucket() argument 293 rht_bucket_var( struct bucket_table *tbl, unsigned int hash) rht_bucket_var() argument 300 rht_bucket_insert( struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) rht_bucket_insert() argument 379 rht_ptr( struct rhash_lock_head __rcu *const *bkt, struct bucket_table *tbl, unsigned int hash) rht_ptr() argument 600 unsigned int hash; __rhashtable_lookup() local 718 unsigned int hash; __rhashtable_insert_fast() local 1004 unsigned int hash; __rhashtable_remove_fast_one() local 1157 unsigned int hash; __rhashtable_replace_fast() local [all...] |
/kernel/linux/linux-5.10/drivers/net/ethernet/freescale/fman/ |
H A D | fman_mac.h | 224 static inline void free_hash_table(struct eth_hash_t *hash) in free_hash_table() argument 229 if (hash) { in free_hash_table() 230 if (hash->lsts) { in free_hash_table() 231 for (i = 0; i < hash->size; i++) { in free_hash_table() 233 dequeue_addr_from_hash_entry(&hash->lsts[i]); in free_hash_table() 237 dequeue_addr_from_hash_entry(&hash-> in free_hash_table() 242 kfree(hash->lsts); in free_hash_table() 245 kfree(hash); in free_hash_table() 252 struct eth_hash_t *hash; in alloc_hash_table() local 254 /* Allocate address hash tabl in alloc_hash_table() [all...] |
/kernel/linux/linux-6.6/drivers/net/ethernet/freescale/fman/ |
H A D | fman_mac.h | 196 static inline void free_hash_table(struct eth_hash_t *hash) in free_hash_table() argument 201 if (hash) { in free_hash_table() 202 if (hash->lsts) { in free_hash_table() 203 for (i = 0; i < hash->size; i++) { in free_hash_table() 205 dequeue_addr_from_hash_entry(&hash->lsts[i]); in free_hash_table() 209 dequeue_addr_from_hash_entry(&hash-> in free_hash_table() 214 kfree(hash->lsts); in free_hash_table() 217 kfree(hash); in free_hash_table() 224 struct eth_hash_t *hash; in alloc_hash_table() local 226 /* Allocate address hash tabl in alloc_hash_table() [all...] |
/kernel/linux/linux-5.10/drivers/gpu/drm/vboxvideo/ |
H A D | vbox_hgsmi.c | 11 /* One-at-a-Time Hash from https://www.burtleburtle.net/bob/hash/doobs.html */ 12 static u32 hgsmi_hash_process(u32 hash, const u8 *data, int size) in hgsmi_hash_process() argument 15 hash += *data++; in hgsmi_hash_process() 16 hash += (hash << 10); in hgsmi_hash_process() 17 hash ^= (hash >> 6); in hgsmi_hash_process() 20 return hash; in hgsmi_hash_process() 23 static u32 hgsmi_hash_end(u32 hash) in hgsmi_hash_end() argument 25 hash in hgsmi_hash_end() [all...] |
/kernel/linux/linux-6.6/drivers/gpu/drm/vboxvideo/ |
H A D | vbox_hgsmi.c | 11 /* One-at-a-Time Hash from https://www.burtleburtle.net/bob/hash/doobs.html */ 12 static u32 hgsmi_hash_process(u32 hash, const u8 *data, int size) in hgsmi_hash_process() argument 15 hash += *data++; in hgsmi_hash_process() 16 hash += (hash << 10); in hgsmi_hash_process() 17 hash ^= (hash >> 6); in hgsmi_hash_process() 20 return hash; in hgsmi_hash_process() 23 static u32 hgsmi_hash_end(u32 hash) in hgsmi_hash_end() argument 25 hash in hgsmi_hash_end() [all...] |
/kernel/linux/linux-6.6/lib/ |
H A D | hashtable_test.c | 37 DEFINE_HASHTABLE(hash, 1); in hashtable_test_hash_empty() 39 KUNIT_EXPECT_TRUE(test, hash_empty(hash)); in hashtable_test_hash_empty() 43 hash_add(hash, &a.node, a.key); in hashtable_test_hash_empty() 46 KUNIT_EXPECT_FALSE(test, hash_empty(hash)); in hashtable_test_hash_empty() 52 DEFINE_HASHTABLE(hash, 4); in hashtable_test_hash_hashed() 56 hash_add(hash, &a.node, a.key); in hashtable_test_hash_hashed() 59 hash_add(hash, &b.node, b.key); in hashtable_test_hash_hashed() 69 DEFINE_HASHTABLE(hash, 3); in hashtable_test_hash_add() 74 hash_add(hash, &a.node, a.key); in hashtable_test_hash_add() 78 hash_add(hash, in hashtable_test_hash_add() [all...] |
/kernel/linux/linux-6.6/arch/powerpc/crypto/ |
H A D | aes-gcm-p10-glue.c | 17 #include <crypto/internal/hash.h> 77 static void set_subkey(unsigned char *hash) in set_subkey() argument 79 *(u64 *)&hash[0] = be64_to_cpup((__be64 *)&hash[0]); in set_subkey() 80 *(u64 *)&hash[8] = be64_to_cpup((__be64 *)&hash[8]); in set_subkey() 87 static void set_aad(struct gcm_ctx *gctx, struct Hash_ctx *hash, in set_aad() argument 96 gcm_ghash_p10(nXi, hash->Htable+32, aad, i); in set_aad() 105 gcm_ghash_p10(gctx->aad_hash, hash->Htable+32, nXi, 16); in set_aad() 110 memcpy(hash in set_aad() 113 gcmp10_init(struct gcm_ctx *gctx, u8 *iv, unsigned char *rdkey, struct Hash_ctx *hash, u8 *assoc, unsigned int assoclen) gcmp10_init() argument 141 finish_tag(struct gcm_ctx *gctx, struct Hash_ctx *hash, int len) finish_tag() argument 208 struct Hash_ctx *hash = PTR_ALIGN((void *)hashbuf, PPC_ALIGN); p10_aes_gcm_crypt() local [all...] |
/kernel/linux/linux-6.6/arch/loongarch/kernel/ |
H A D | relocate.c | 70 static inline __init unsigned long rotate_xor(unsigned long hash, in rotate_xor() argument 74 const typeof(hash) *ptr = PTR_ALIGN(area, sizeof(hash)); in rotate_xor() 77 if (size < diff + sizeof(hash)) in rotate_xor() 78 return hash; in rotate_xor() 80 size = ALIGN_DOWN(size - diff, sizeof(hash)); in rotate_xor() 82 for (i = 0; i < size / sizeof(hash); i++) { in rotate_xor() 84 hash = (hash << ((sizeof(hash) * in rotate_xor() 93 unsigned long hash = 0; get_random_boot() local [all...] |
/kernel/linux/linux-6.6/drivers/gpu/drm/vmwgfx/ |
H A D | vmwgfx_cmdbuf_res.c | 39 * @hash: Hash entry for the manager hash table. 47 struct vmwgfx_hash_item hash; member 86 struct vmwgfx_hash_item *hash; in vmw_cmdbuf_res_lookup() local 89 hash_for_each_possible_rcu(man->resources, hash, head, key) { in vmw_cmdbuf_res_lookup() 90 if (hash->key == key) in vmw_cmdbuf_res_lookup() 91 return hlist_entry(hash, struct vmw_cmdbuf_res, hash)->res; in vmw_cmdbuf_res_lookup() 109 hash_del_rcu(&entry->hash.head); in vmw_cmdbuf_res_free() 170 hash_add_rcu(entry->man->resources, &entry->hash in vmw_cmdbuf_res_revert() 241 struct vmwgfx_hash_item *hash; vmw_cmdbuf_res_remove() local [all...] |
/kernel/linux/linux-5.10/security/apparmor/ |
H A D | crypto.c | 14 #include <crypto/hash.h> 31 char *hash = NULL; in aa_calc_hash() local 37 hash = kzalloc(apparmor_hash_size, GFP_KERNEL); in aa_calc_hash() 38 if (!hash) in aa_calc_hash() 49 error = crypto_shash_final(desc, hash); in aa_calc_hash() 53 return hash; in aa_calc_hash() 56 kfree(hash); in aa_calc_hash() 74 profile->hash = kzalloc(apparmor_hash_size, GFP_KERNEL); in aa_calc_profile_hash() 75 if (!profile->hash) in aa_calc_profile_hash() 89 error = crypto_shash_final(desc, profile->hash); in aa_calc_profile_hash() [all...] |
/kernel/linux/linux-6.6/security/apparmor/ |
H A D | crypto.c | 14 #include <crypto/hash.h> 31 char *hash; in aa_calc_hash() local 37 hash = kzalloc(apparmor_hash_size, GFP_KERNEL); in aa_calc_hash() 38 if (!hash) in aa_calc_hash() 49 error = crypto_shash_final(desc, hash); in aa_calc_hash() 53 return hash; in aa_calc_hash() 56 kfree(hash); in aa_calc_hash() 74 profile->hash = kzalloc(apparmor_hash_size, GFP_KERNEL); in aa_calc_profile_hash() 75 if (!profile->hash) in aa_calc_profile_hash() 89 error = crypto_shash_final(desc, profile->hash); in aa_calc_profile_hash() [all...] |
/kernel/linux/linux-6.6/arch/mips/cavium-octeon/crypto/ |
H A D | octeon-md5.c | 29 #include <crypto/internal/hash.h> 39 u64 *hash = (u64 *)ctx->hash; in octeon_md5_store_hash() local 41 write_octeon_64bit_hash_dword(hash[0], 0); in octeon_md5_store_hash() 42 write_octeon_64bit_hash_dword(hash[1], 1); in octeon_md5_store_hash() 47 u64 *hash = (u64 *)ctx->hash; in octeon_md5_read_hash() local 49 hash[0] = read_octeon_64bit_hash_dword(0); in octeon_md5_read_hash() 50 hash[1] = read_octeon_64bit_hash_dword(1); in octeon_md5_read_hash() 71 mctx->hash[ in octeon_md5_init() [all...] |
/kernel/linux/linux-5.10/arch/loongarch/kernel/ |
H A D | relocate.c | 102 static inline __init unsigned long rotate_xor(unsigned long hash, in rotate_xor() argument 106 const typeof(hash) *ptr = PTR_ALIGN(area, sizeof(hash)); in rotate_xor() 109 if (unlikely(size < diff + sizeof(hash))) in rotate_xor() 110 return hash; in rotate_xor() 112 size = ALIGN_DOWN(size - diff, sizeof(hash)); in rotate_xor() 114 for (i = 0; i < size / sizeof(hash); i++) { in rotate_xor() 116 hash = (hash << ((sizeof(hash) * in rotate_xor() 125 unsigned long hash = 0; get_random_boot() local [all...] |
/kernel/linux/linux-6.6/fs/ntfs3/ |
H A D | lznt.c | 35 struct lznt_hash hash[LZNT_CHUNK_SIZE]; member 52 const u8 **hash; in longest_match_std() local 58 hash = &(ctx->hash[hash_index].p1); in longest_match_std() 60 if (hash[0] >= ctx->unc && hash[0] < src && hash[0][0] == src[0] && in longest_match_std() 61 hash[0][1] == src[1] && hash[0][2] == src[2]) { in longest_match_std() 65 hash[ in longest_match_std() [all...] |