X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fhelloworld%2Fmain.c;h=af509138da9aa4a904ad2c171ecdd816eafa1415;hb=ae835aba40349ee9631ef6b52e68a2893febe7e0;hp=8a4cee60ff07418b8327b144f562fdaab19025bc;hpb=cb056611a8ed9ab9024f3b91bf26e97255194514;p=dpdk.git diff --git a/examples/helloworld/main.c b/examples/helloworld/main.c index 8a4cee60ff..af509138da 100644 --- a/examples/helloworld/main.c +++ b/examples/helloworld/main.c @@ -15,6 +15,7 @@ #include #include +/* Launch a function on lcore. 8< */ static int lcore_hello(__rte_unused void *arg) { @@ -23,7 +24,9 @@ lcore_hello(__rte_unused void *arg) printf("hello from core %u\n", lcore_id); return 0; } +/* >8 End of launching function on lcore. */ +/* Initialization of Environment Abstraction Layer (EAL). 8< */ int main(int argc, char **argv) { @@ -33,15 +36,23 @@ main(int argc, char **argv) ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); + /* >8 End of initialization of Environment Abstraction Layer */ - /* call lcore_hello() on every worker lcore */ + /* Launches the function on each lcore. 8< */ RTE_LCORE_FOREACH_WORKER(lcore_id) { + /* Simpler equivalent. 8< */ rte_eal_remote_launch(lcore_hello, NULL, lcore_id); + /* >8 End of simpler equivalent. */ } /* call it on main lcore too */ lcore_hello(NULL); + /* >8 End of launching the function on each lcore. */ rte_eal_mp_wait_lcore(); + + /* clean up the EAL */ + rte_eal_cleanup(); + return 0; }