-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cc
72 lines (60 loc) · 1.18 KB
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <thread>
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
#include "xellico.h"
#include "dpdk_misc.h"
#include "config.h"
#include "forwarder.h"
#include "force_quit.h"
#include "port.h"
#include "delay.h"
xellico_conf_t* xeconf;
static int
launcher (__attribute__ ((unused)) void *dummy)
{
forwarder ();
return 0;
}
static void
signal_handler (int signum)
{
if (signum == SIGINT || signum == SIGTERM)
{
printf ("\n\nSignal %d received, preparing to exit...\n", signum);
force_quit = true;
}
}
void debug (void)
{
while (!force_quit)
{
dump_pktmbuf_pool ();
sleep (1);
}
}
int
main (int argc, char **argv)
{
int ret = xellico_boot_dpdk (argc, argv);
argc -= ret;
argv += ret;
force_quit = false;
signal (SIGINT, signal_handler);
signal (SIGTERM, signal_handler);
xeconf = new_xeconf ("config.json");
port_init ();
init_fib ();
rte_eal_mp_remote_launch (launcher, NULL, SKIP_MASTER);
rte_eal_mp_wait_lcore ();
port_fini ();
free_xeconf (xeconf);
printf ("Bye...\n");
return ret;
}