New upstream version 18.02
[deb_dpdk.git] / examples / load_balancer / main.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <stdint.h>
8 #include <inttypes.h>
9 #include <sys/types.h>
10 #include <string.h>
11 #include <sys/queue.h>
12 #include <stdarg.h>
13 #include <errno.h>
14 #include <getopt.h>
15 #include <unistd.h>
16
17 #include <rte_common.h>
18 #include <rte_byteorder.h>
19 #include <rte_log.h>
20 #include <rte_memory.h>
21 #include <rte_memcpy.h>
22 #include <rte_eal.h>
23 #include <rte_launch.h>
24 #include <rte_atomic.h>
25 #include <rte_cycles.h>
26 #include <rte_prefetch.h>
27 #include <rte_lcore.h>
28 #include <rte_per_lcore.h>
29 #include <rte_branch_prediction.h>
30 #include <rte_interrupts.h>
31 #include <rte_random.h>
32 #include <rte_debug.h>
33 #include <rte_ether.h>
34 #include <rte_ethdev.h>
35 #include <rte_mempool.h>
36 #include <rte_mbuf.h>
37 #include <rte_ip.h>
38 #include <rte_tcp.h>
39 #include <rte_lpm.h>
40
41 #include "main.h"
42
43 int
44 main(int argc, char **argv)
45 {
46         uint32_t lcore;
47         int ret;
48
49         /* Init EAL */
50         ret = rte_eal_init(argc, argv);
51         if (ret < 0)
52                 return -1;
53         argc -= ret;
54         argv += ret;
55
56         /* Parse application arguments (after the EAL ones) */
57         ret = app_parse_args(argc, argv);
58         if (ret < 0) {
59                 app_print_usage();
60                 return -1;
61         }
62
63         /* Init */
64         app_init();
65         app_print_params();
66
67         /* Launch per-lcore init on every lcore */
68         rte_eal_mp_remote_launch(app_lcore_main_loop, NULL, CALL_MASTER);
69         RTE_LCORE_FOREACH_SLAVE(lcore) {
70                 if (rte_eal_wait_lcore(lcore) < 0) {
71                         return -1;
72                 }
73         }
74
75         return 0;
76 }