| 289 | } |
| 290 | |
| 291 | static int |
| 292 | fbk_create_free(__rte_unused void *arg) |
| 293 | { |
| 294 | unsigned lcore_self = rte_lcore_id(); |
| 295 | struct rte_fbk_hash_table *handle; |
| 296 | char fbk_name[MAX_STRING_SIZE]; |
| 297 | int i; |
| 298 | struct rte_fbk_hash_params fbk_params = { |
| 299 | .name = NULL, |
| 300 | .entries = 4, |
| 301 | .entries_per_bucket = 4, |
| 302 | .socket_id = 0, |
| 303 | .hash_func = rte_jhash_1word, |
| 304 | .init_val = RTE_FBK_HASH_INIT_VAL_DEFAULT, |
| 305 | }; |
| 306 | |
| 307 | WAIT_SYNCHRO_FOR_WORKERS(); |
| 308 | |
| 309 | /* create the same fbk hash table simultaneously on all threads */ |
| 310 | fbk_params.name = "fr_test_once"; |
| 311 | for (i = 0; i < MAX_ITER_ONCE; i++) { |
| 312 | handle = rte_fbk_hash_create(&fbk_params); |
| 313 | if (handle != NULL) |
| 314 | __atomic_fetch_add(&obj_count, 1, __ATOMIC_RELAXED); |
| 315 | } |
| 316 | |
| 317 | /* create multiple fbk tables simultaneously */ |
| 318 | for (i = 0; i < MAX_ITER_MULTI; i++) { |
| 319 | snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i); |
| 320 | fbk_params.name = fbk_name; |
| 321 | |
| 322 | handle = rte_fbk_hash_create(&fbk_params); |
| 323 | if (NULL == handle) |
| 324 | return -1; |
| 325 | |
| 326 | /* verify correct existing and then free all */ |
| 327 | if (handle != rte_fbk_hash_find_existing(fbk_name)) |
| 328 | return -1; |
| 329 | |
| 330 | rte_fbk_hash_free(handle); |
| 331 | |
| 332 | /* verify free correct */ |
| 333 | if (NULL != rte_fbk_hash_find_existing(fbk_name)) |
| 334 | return -1; |
| 335 | } |
| 336 | |
| 337 | return 0; |
| 338 | } |
| 339 | #endif /* RTE_LIB_HASH */ |
| 340 | |
| 341 | #ifdef RTE_LIB_LPM |
nothing calls this directly
no test coverage detected