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

Function hash_create_free

dpdk/app/test/test_func_reentrancy.c:224–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224static int
225hash_create_free(__rte_unused void *arg)
226{
227 unsigned lcore_self = rte_lcore_id();
228 struct rte_hash *handle;
229 char hash_name[MAX_STRING_SIZE];
230 int i;
231 struct rte_hash_parameters hash_params = {
232 .name = NULL,
233 .entries = 16,
234 .key_len = 4,
235 .hash_func = (rte_hash_function)rte_jhash_32b,
236 .hash_func_init_val = 0,
237 .socket_id = 0,
238 };
239
240 WAIT_SYNCHRO_FOR_WORKERS();
241
242 /* create the same hash simultaneously on all threads */
243 hash_params.name = "fr_test_once";
244 for (i = 0; i < MAX_ITER_ONCE; i++) {
245 handle = rte_hash_create(&hash_params);
246 if (handle != NULL)
247 __atomic_fetch_add(&obj_count, 1, __ATOMIC_RELAXED);
248 }
249
250 /* create multiple times simultaneously */
251 for (i = 0; i < MAX_ITER_MULTI; i++) {
252 snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i);
253 hash_params.name = hash_name;
254
255 handle = rte_hash_create(&hash_params);
256 if (NULL == handle)
257 return -1;
258
259 /* verify correct existing and then free all */
260 if (handle != rte_hash_find_existing(hash_name))
261 return -1;
262
263 rte_hash_free(handle);
264
265 /* verify free correct */
266 if (NULL != rte_hash_find_existing(hash_name))
267 return -1;
268 }
269
270 return 0;
271}
272
273static void
274fbk_clean(unsigned lcore_id)

Callers

nothing calls this directly

Calls 5

rte_lcore_idFunction · 0.85
rte_hash_createFunction · 0.85
snprintfFunction · 0.85
rte_hash_find_existingFunction · 0.85
rte_hash_freeFunction · 0.85

Tested by

no test coverage detected