xref: /dpdk/examples/pipeline/main.c (revision b77f660028127061b05a8a14cc6c93becb9e73bb)
1*b77f6600SCristian Dumitrescu /* SPDX-License-Identifier: BSD-3-Clause
2*b77f6600SCristian Dumitrescu  * Copyright(c) 2020 Intel Corporation
3*b77f6600SCristian Dumitrescu  */
4*b77f6600SCristian Dumitrescu 
5*b77f6600SCristian Dumitrescu #include <stdio.h>
6*b77f6600SCristian Dumitrescu #include <string.h>
7*b77f6600SCristian Dumitrescu #include <fcntl.h>
8*b77f6600SCristian Dumitrescu #include <unistd.h>
9*b77f6600SCristian Dumitrescu #include <getopt.h>
10*b77f6600SCristian Dumitrescu 
11*b77f6600SCristian Dumitrescu #include <rte_launch.h>
12*b77f6600SCristian Dumitrescu #include <rte_eal.h>
13*b77f6600SCristian Dumitrescu 
14*b77f6600SCristian Dumitrescu #include "obj.h"
15*b77f6600SCristian Dumitrescu #include "thread.h"
16*b77f6600SCristian Dumitrescu 
17*b77f6600SCristian Dumitrescu int
18*b77f6600SCristian Dumitrescu main(int argc, char **argv)
19*b77f6600SCristian Dumitrescu {
20*b77f6600SCristian Dumitrescu 	struct obj *obj;
21*b77f6600SCristian Dumitrescu 	int status;
22*b77f6600SCristian Dumitrescu 
23*b77f6600SCristian Dumitrescu 	/* EAL */
24*b77f6600SCristian Dumitrescu 	status = rte_eal_init(argc, argv);
25*b77f6600SCristian Dumitrescu 	if (status < 0) {
26*b77f6600SCristian Dumitrescu 		printf("Error: EAL initialization failed (%d)\n", status);
27*b77f6600SCristian Dumitrescu 		return status;
28*b77f6600SCristian Dumitrescu 	};
29*b77f6600SCristian Dumitrescu 
30*b77f6600SCristian Dumitrescu 	/* Obj */
31*b77f6600SCristian Dumitrescu 	obj = obj_init();
32*b77f6600SCristian Dumitrescu 	if (!obj) {
33*b77f6600SCristian Dumitrescu 		printf("Error: Obj initialization failed (%d)\n", status);
34*b77f6600SCristian Dumitrescu 		return status;
35*b77f6600SCristian Dumitrescu 	}
36*b77f6600SCristian Dumitrescu 
37*b77f6600SCristian Dumitrescu 	/* Thread */
38*b77f6600SCristian Dumitrescu 	status = thread_init();
39*b77f6600SCristian Dumitrescu 	if (status) {
40*b77f6600SCristian Dumitrescu 		printf("Error: Thread initialization failed (%d)\n", status);
41*b77f6600SCristian Dumitrescu 		return status;
42*b77f6600SCristian Dumitrescu 	}
43*b77f6600SCristian Dumitrescu 
44*b77f6600SCristian Dumitrescu 	rte_eal_mp_remote_launch(
45*b77f6600SCristian Dumitrescu 		thread_main,
46*b77f6600SCristian Dumitrescu 		NULL,
47*b77f6600SCristian Dumitrescu 		SKIP_MASTER);
48*b77f6600SCristian Dumitrescu 
49*b77f6600SCristian Dumitrescu 	return 0;
50*b77f6600SCristian Dumitrescu }
51