| 330 | } |
| 331 | |
| 332 | static int |
| 333 | test_mt1(int (*test)(void *)) |
| 334 | { |
| 335 | int32_t rc; |
| 336 | uint32_t lc, mc; |
| 337 | struct rte_ring *r; |
| 338 | void *data; |
| 339 | struct lcore_arg arg[RTE_MAX_LCORE]; |
| 340 | |
| 341 | static const struct lcore_stat init_stat = { |
| 342 | .op.min_cycle = UINT64_MAX, |
| 343 | }; |
| 344 | |
| 345 | rc = mt1_init(&r, &data, RING_SIZE); |
| 346 | if (rc != 0) { |
| 347 | mt1_fini(r, data); |
| 348 | return rc; |
| 349 | } |
| 350 | |
| 351 | memset(arg, 0, sizeof(arg)); |
| 352 | |
| 353 | /* launch on all workers */ |
| 354 | RTE_LCORE_FOREACH_WORKER(lc) { |
| 355 | arg[lc].rng = r; |
| 356 | arg[lc].stats = init_stat; |
| 357 | rte_eal_remote_launch(test, &arg[lc], lc); |
| 358 | } |
| 359 | |
| 360 | /* signal worker to start test */ |
| 361 | __atomic_store_n(&wrk_cmd, WRK_CMD_RUN, __ATOMIC_RELEASE); |
| 362 | |
| 363 | rte_delay_us(run_time * US_PER_S); |
| 364 | |
| 365 | /* signal worker to start test */ |
| 366 | __atomic_store_n(&wrk_cmd, WRK_CMD_STOP, __ATOMIC_RELEASE); |
| 367 | |
| 368 | /* wait for workers and collect stats. */ |
| 369 | mc = rte_lcore_id(); |
| 370 | arg[mc].stats = init_stat; |
| 371 | |
| 372 | rc = 0; |
| 373 | RTE_LCORE_FOREACH_WORKER(lc) { |
| 374 | rc |= rte_eal_wait_lcore(lc); |
| 375 | lcore_stat_aggr(&arg[mc].stats, &arg[lc].stats); |
| 376 | if (verbose != 0) |
| 377 | lcore_stat_dump(stdout, lc, &arg[lc].stats); |
| 378 | } |
| 379 | |
| 380 | lcore_stat_dump(stdout, UINT32_MAX, &arg[mc].stats); |
| 381 | mt1_fini(r, data); |
| 382 | return rc; |
| 383 | } |
| 384 | |
| 385 | static const struct test_case tests[] = { |
| 386 | { |
nothing calls this directly
no test coverage detected