-
Notifications
You must be signed in to change notification settings - Fork 0
/
xellico.h
74 lines (66 loc) · 1.62 KB
/
xellico.h
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
71
72
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <netinet/in.h>
#include <setjmp.h>
#include <stdarg.h>
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <signal.h>
#include <stdbool.h>
#include <rte_common.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
#include <rte_random.h>
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#define RTE_LOGTYPE_XELLICO RTE_LOGTYPE_USER1
#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
static inline int
xellico_boot_dpdk (int argc, char** argv)
{
int ret = rte_eal_init(argc, argv);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
return ret;
}
static inline size_t
rte_socket_count (void)
{
const size_t rte_max_socket = 128;
uint8_t socket_enable[rte_max_socket];
memset (socket_enable, 0x0, sizeof(socket_enable));
for (size_t i=0; i<RTE_MAX_LCORE; i++) {
if (rte_lcore_is_enabled (i))
{
uint8_t socket_id = rte_lcore_to_socket_id(i);
socket_enable[socket_id] = 1;
}
}
size_t socket_count = 0;
for (size_t i=0; i<rte_max_socket; i++)
socket_count += socket_enable[i];
return socket_count;
}