MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_hash_create

Function rte_hash_create

dpdk/lib/hash/rte_cuckoo_hash.c:131–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131struct rte_hash *
132rte_hash_create(const struct rte_hash_parameters *params)
133{
134 struct rte_hash *h = NULL;
135 struct rte_tailq_entry *te = NULL;
136 struct rte_hash_list *hash_list;
137 struct rte_ring *r = NULL;
138 struct rte_ring *r_ext = NULL;
139 char hash_name[RTE_HASH_NAMESIZE];
140 void *k = NULL;
141 void *buckets = NULL;
142 void *buckets_ext = NULL;
143 char ring_name[RTE_RING_NAMESIZE];
144 char ext_ring_name[RTE_RING_NAMESIZE];
145 unsigned num_key_slots;
146 unsigned int hw_trans_mem_support = 0, use_local_cache = 0;
147 unsigned int ext_table_support = 0;
148 unsigned int readwrite_concur_support = 0;
149 unsigned int writer_takes_lock = 0;
150 unsigned int no_free_on_del = 0;
151 uint32_t *ext_bkt_to_free = NULL;
152 RTE_ATOMIC(uint32_t) *tbl_chng_cnt = NULL;
153 struct lcore_cache *local_free_slots = NULL;
154 unsigned int readwrite_concur_lf_support = 0;
155 uint32_t i;
156
157 rte_hash_function default_hash_func = (rte_hash_function)rte_jhash;
158
159 hash_list = RTE_TAILQ_CAST(rte_hash_tailq.head, rte_hash_list);
160
161 if (params == NULL) {
162 RTE_LOG(ERR, HASH, "rte_hash_create has no parameters\n");
163 return NULL;
164 }
165
166 /* Check for valid parameters */
167 if ((params->entries > RTE_HASH_ENTRIES_MAX) ||
168 (params->entries < RTE_HASH_BUCKET_ENTRIES) ||
169 (params->name == NULL) ||
170 (params->key_len == 0)) {
171 rte_errno = EINVAL;
172 RTE_LOG(ERR, HASH, "rte_hash_create has invalid parameters\n");
173 return NULL;
174 }
175
176 if (params->extra_flag & ~RTE_HASH_EXTRA_FLAGS_MASK) {
177 rte_errno = EINVAL;
178 RTE_LOG(ERR, HASH, "rte_hash_create: unsupported extra flags\n");
179 return NULL;
180 }
181
182 /* Validate correct usage of extra options */
183 if ((params->extra_flag & RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY) &&
184 (params->extra_flag & RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF)) {
185 rte_errno = EINVAL;
186 RTE_LOG(ERR, HASH, "rte_hash_create: choose rw concurrency or "
187 "rw concurrency lock free\n");
188 return NULL;

Callers 15

rte_lpm6_createFunction · 0.85
rte_ipsec_sad_createFunction · 0.85
rte_lpm6_createFunction · 0.85
rte_vhost_crypto_createFunction · 0.85
setup_udp4_dstprt_hashFunction · 0.85
memif_create_socket_hashFunction · 0.85
hinic_osdep_initFunction · 0.85
enic_fm_init_actionsFunction · 0.85
nfp_flow_priv_initFunction · 0.85
nfp_ct_zone_entry_initFunction · 0.85
cpfl_vport_map_initFunction · 0.85

Calls 15

snprintfFunction · 0.85
rte_ring_create_elemFunction · 0.85
strncmpFunction · 0.85
rte_zmallocFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_ring_sp_enqueue_elemFunction · 0.85
rte_mallocFunction · 0.85
rte_rwlock_initFunction · 0.85
rte_ring_freeFunction · 0.85
rte_freeFunction · 0.85

Tested by 15

init_hashFunction · 0.68
hash_create_freeFunction · 0.68
test_hash_multiwriterFunction · 0.68
init_paramsFunction · 0.68
init_paramsFunction · 0.68
create_tableFunction · 0.68
get_input_keysFunction · 0.68
init_hashFunction · 0.68
test_add_deleteFunction · 0.68
test_add_update_deleteFunction · 0.68
test_add_delete_free_lfFunction · 0.68