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

Function test_atomic

dpdk/app/test/test_atomic.c:444–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442 return 0;
443}
444static int
445test_atomic(void)
446{
447 rte_atomic16_init(&a16);
448 rte_atomic32_init(&a32);
449 rte_atomic64_init(&a64);
450 rte_atomic64_init(&count);
451 rte_atomic32_init(&synchro);
452
453 rte_atomic16_set(&a16, 1UL << 10);
454 rte_atomic32_set(&a32, 1UL << 10);
455 rte_atomic64_set(&a64, 1ULL << 33);
456
457 printf("usual inc/dec/add/sub functions\n");
458
459 rte_eal_mp_remote_launch(test_atomic_usual, NULL, SKIP_MAIN);
460 rte_atomic32_set(&synchro, 1);
461 rte_eal_mp_wait_lcore();
462 rte_atomic32_set(&synchro, 0);
463
464 if (rte_atomic16_read(&a16) != 1UL << 10) {
465 printf("Atomic16 usual functions failed\n");
466 return -1;
467 }
468
469 if (rte_atomic32_read(&a32) != 1UL << 10) {
470 printf("Atomic32 usual functions failed\n");
471 return -1;
472 }
473
474 if (rte_atomic64_read(&a64) != 1ULL << 33) {
475 printf("Atomic64 usual functions failed\n");
476 return -1;
477 }
478
479 printf("test and set\n");
480
481 rte_atomic64_set(&a64, 0);
482 rte_atomic32_set(&a32, 0);
483 rte_atomic16_set(&a16, 0);
484 rte_atomic64_set(&count, 0);
485 rte_eal_mp_remote_launch(test_atomic_tas, NULL, SKIP_MAIN);
486 rte_atomic32_set(&synchro, 1);
487 rte_eal_mp_wait_lcore();
488 rte_atomic32_set(&synchro, 0);
489
490 if (rte_atomic64_read(&count) != NUM_ATOMIC_TYPES) {
491 printf("Atomic test and set failed\n");
492 return -1;
493 }
494
495 printf("add/sub and return\n");
496
497 rte_atomic64_set(&a64, 0);
498 rte_atomic32_set(&a32, 0);
499 rte_atomic16_set(&a16, 0);
500 rte_atomic64_set(&count, 0);
501 rte_eal_mp_remote_launch(test_atomic_addsub_and_return, NULL,

Callers

nothing calls this directly

Calls 15

rte_atomic16_initFunction · 0.85
rte_atomic32_initFunction · 0.85
rte_atomic16_setFunction · 0.85
rte_atomic32_setFunction · 0.85
rte_eal_mp_remote_launchFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
rte_atomic16_readFunction · 0.85
rte_atomic32_readFunction · 0.85
rte_atomic32_clearFunction · 0.85
rte_atomic16_clearFunction · 0.85
rte_lcore_countFunction · 0.85
build_crc8_tableFunction · 0.85

Tested by

no test coverage detected