| 358 | } |
| 359 | |
| 360 | static int |
| 361 | lpm_create_free(__rte_unused void *arg) |
| 362 | { |
| 363 | unsigned lcore_self = rte_lcore_id(); |
| 364 | struct rte_lpm *lpm; |
| 365 | struct rte_lpm_config config; |
| 366 | |
| 367 | config.max_rules = 4; |
| 368 | config.number_tbl8s = 256; |
| 369 | config.flags = 0; |
| 370 | char lpm_name[MAX_STRING_SIZE]; |
| 371 | int i; |
| 372 | |
| 373 | WAIT_SYNCHRO_FOR_WORKERS(); |
| 374 | |
| 375 | /* create the same lpm simultaneously on all threads */ |
| 376 | for (i = 0; i < MAX_ITER_ONCE; i++) { |
| 377 | lpm = rte_lpm_create("fr_test_once", SOCKET_ID_ANY, &config); |
| 378 | if (lpm != NULL) |
| 379 | __atomic_fetch_add(&obj_count, 1, __ATOMIC_RELAXED); |
| 380 | } |
| 381 | |
| 382 | /* create multiple fbk tables simultaneously */ |
| 383 | for (i = 0; i < MAX_LPM_ITER_TIMES; i++) { |
| 384 | snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_self, i); |
| 385 | lpm = rte_lpm_create(lpm_name, SOCKET_ID_ANY, &config); |
| 386 | if (NULL == lpm) |
| 387 | return -1; |
| 388 | |
| 389 | /* verify correct existing and then free all */ |
| 390 | if (lpm != rte_lpm_find_existing(lpm_name)) |
| 391 | return -1; |
| 392 | |
| 393 | rte_lpm_free(lpm); |
| 394 | |
| 395 | /* verify free correct */ |
| 396 | if (NULL != rte_lpm_find_existing(lpm_name)) |
| 397 | return -1; |
| 398 | } |
| 399 | |
| 400 | return 0; |
| 401 | } |
| 402 | #endif /* RTE_LIB_LPM */ |
| 403 | |
| 404 | struct test_case{ |
nothing calls this directly
no test coverage detected