Currently the sample app user guides use hard coded code snippets, this patch changes these to use literalinclude which will dynamically update the snippets as changes are made to the code. This was introduced in commit 413c75c33c40 ("doc: show how to include code in guides"). Comments within the sample apps were updated to accommodate this as part of this patch. This will help to ensure that the code within the sample app user guides is up to date and not out of sync with the actual code. Signed-off-by: Conor Fogarty <conor.fogarty@intel.com> Signed-off-by: Conor Walsh <conor.walsh@intel.com> Acked-by: John McNamara <john.mcnamara@intel.com>
59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <errno.h>
|
|
#include <sys/queue.h>
|
|
|
|
#include <rte_memory.h>
|
|
#include <rte_launch.h>
|
|
#include <rte_eal.h>
|
|
#include <rte_per_lcore.h>
|
|
#include <rte_lcore.h>
|
|
#include <rte_debug.h>
|
|
|
|
/* Launch a function on lcore. 8< */
|
|
static int
|
|
lcore_hello(__rte_unused void *arg)
|
|
{
|
|
unsigned lcore_id;
|
|
lcore_id = rte_lcore_id();
|
|
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)
|
|
{
|
|
int ret;
|
|
unsigned lcore_id;
|
|
|
|
ret = rte_eal_init(argc, argv);
|
|
if (ret < 0)
|
|
rte_panic("Cannot init EAL\n");
|
|
/* >8 End of initialization of Environment Abstraction Layer */
|
|
|
|
/* 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;
|
|
}
|