summaryrefslogtreecommitdiff
path: root/service/include/sc_common.h
blob: 1d99d3cbe271be80ca238f9cdc5e4e1628154bc5 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#pragma once

#include <common.h>
#include <ldbc.h>
#include <rte_keepalive.h>
#include <sc_devmgr.h>
#include <sys/queue.h>

#define MR_VLAN_FWD_ENABLE 1

static inline const char * str_dist_mode(unsigned int distmode)
{
    switch (distmode)
    {
    case 0:
        return "Tuple2(Software)";
    case 1:
        return "Tuple4(Software)";
    case 2:
        return "Tuple4(Janus)";
    case 3:
        return "Use RSS Result";
    default:
        return "Unknown";
    }
    return NULL;
}

struct sc_ctrlzone
{
    TAILQ_ENTRY(sc_ctrlzone) next;
    char symbol[MR_SYMBOL_MAX];
    unsigned int id;
    unsigned int size;
};

TAILQ_HEAD(sc_ctrlzone_list, sc_ctrlzone);

struct phydev_main;
struct hwinfo_main;
struct vdev_main;
struct sw_forward_main;
struct smartoffload_main;
struct app_main;
struct vlan_base_fwd_main;
struct flow_manage_main;
struct node_manager_main;
struct node_classifier_main;
struct node_lb_main;
struct ef_node_main;
struct rpc_server_handler;
struct node_eth_egress_main;
struct node_bfd_main;
struct olp_manager_main;
struct http_serv_main;

/* Service Instance */
struct sc_main
{
    /* 进程代号 */
    char appsym[MR_SYMBOL_MAX];
    /* 本地硬件配置文件 */
    char local_hwfile[MR_STRING_MAX];
    /* 本地配置文件位置 */
    char local_cfgfile[MR_STRING_MAX];
    /* 本地动态配置文件位置 */
    char local_dyfile[MR_STRING_MAX];
    /* 本地日志文件位置 */
    char local_logfile[MR_STRING_MAX];
    /* 状态监测文件 */
    char local_monitfile[MR_STRING_MAX];
    /* CPU掩码,本进程在这个CPU上运行 */
    cpu_set_t cpu_set_io;
    /* Master线程的CPU亲和性设置(EAL之前) */
    cpu_set_t cpu_set_before_eal;
    /* Master线程的CPU亲和性设置(EAL之后) */
    cpu_set_t cpu_set_after_eal;
    /* SmartOffload控制报文处理CPU掩码 */
    cpu_set_t cpu_set_offload;

    /* RX方向 Burst数量 */
    unsigned int nr_rx_burst;
    /* TX方向 Burst数量 */
    unsigned int nr_tx_burst;
    /* 线程数 */
    unsigned int nr_io_thread;
    /* thread count */
    unsigned int nr_offload_thread;
    /* 数据面:IDLE操作门限 */
    unsigned int idle_threshold;

    /* SIGSEGV状态接管 */
    unsigned int en_sig_segv_takeover;
    /* 异常状态检测标志位,死锁检测 */
    unsigned int en_spinlock_check;
    /* 异常状态检测标志位,控制死锁检测 */
    unsigned int en_ctrl_spinlock_check;
    /* 控制死锁检测检测间隔 */
    unsigned int ctrl_spinlock_check_interval;

    /* 软件报文时间戳 */
    unsigned int en_pkt_timestamp;
    /* 捕包支持 */
    unsigned int en_pkt_dumper;
    /* mpack route metadata enable */
    unsigned int en_mpack_metadata;
    /* mpack route ctx enable */
    unsigned int en_mpack_route_ctx;
    /* 延迟统计 */
    unsigned int en_pkt_latency;
    /* 延迟统计核心 */
    unsigned int pkt_latency_lcore_id;
    /* 延迟统计采样周期 */
    unsigned int pkt_latency_sample_interval;
    /* 负载均衡器 */
    struct distributer * dist_object;
    /* keepalive监测 */
    struct rte_keepalive * keepalive;
    /*rpc服务端句柄*/
    struct rpc_server_handler * rpc_srv_handler;
    /* 硬件基础信息 */
    struct hwinfo_main * hwinfo_main;
    /* 物理设备管理 */
    struct devmgr_main * devmgr_main;
    /* 内存池管理 */
    struct mrb_main * mrb_pool_main;
    /* 虚设备管理 */
    struct vdev_main * vdev_main;
    /* 应用管理 */
    struct app_main * app_main;
    /* 交换模块 --- 线路交换 */
    struct sw_forward_main * sw_forward_main;
    /* SmartOffload */
    struct smartoffload_main * smartoffload_main;
    /* Flow Manage */
    struct flow_manage_main * flow_manage_main;
    /* 交换模块 --- 基于vlan id */
    struct vlan_base_fwd_main * vlan_base_fwd_main;
    /* Node Manager */
    struct node_manager_main * node_mgr_main;
    /* OLP Manager */
    struct olp_manager_main * olp_mgr_main;
    /* HTTP Server */
    struct http_serv_main * ht_server_main;
    /* data path trace*/
    struct dp_trace_process * trace;
};

struct sc_main * sc_main_get();
extern unsigned int g_keep_running;