10aa375704
According to the programming guide, the rte_eal_init should be used pairs with rte_eal_cleanup. This patch add rte_eal_cleanup to examples to encourage new users of DPDK to use it. Fixes: aec9c13c5257 ("eal: add function to release internal resources") Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application") Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver") Fixes: 4ff457986f76 ("examples/l2fwd-event: add default poll mode routines") Fixes: 08bd1a174461 ("examples/l3fwd-graph: add graph-based l3fwd skeleton") Fixes: c5eebf85badc ("examples/ntb: add example for NTB") Fixes: b77f66002812 ("examples/pipeline: add new example application") Fixes: edbed86d1cc3 ("examples/vdpa: introduce a new sample for vDPA") Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample") Fixes: f5188211c721 ("examples/vhost_crypto: add sample application") Cc: stable@dpdk.org Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
52 lines
919 B
C
52 lines
919 B
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>
|
|
|
|
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;
|
|
}
|
|
|
|
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");
|
|
|
|
/* call lcore_hello() on every worker lcore */
|
|
RTE_LCORE_FOREACH_WORKER(lcore_id) {
|
|
rte_eal_remote_launch(lcore_hello, NULL, lcore_id);
|
|
}
|
|
|
|
/* call it on main lcore too */
|
|
lcore_hello(NULL);
|
|
|
|
rte_eal_mp_wait_lcore();
|
|
|
|
/* clean up the EAL */
|
|
rte_eal_cleanup();
|
|
|
|
return 0;
|
|
}
|