2 // Copyright (c) 2010-2020 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
21 #include <rte_ether.h>
23 #include "prox_globals.h"
25 #include "prox_compat.h"
27 #define PROX_CM_STR_LEN (2 + 2 * sizeof(prox_cfg.core_mask) + 1)
28 #define PROX_CM_DIM (RTE_MAX_LCORE/(sizeof(uint64_t) * 8))
30 #define DSF_AUTOSTART 0x00000001 /* start all cores automatically */
31 #define DSF_CHECK_INIT 0x00000002 /* check initialization sequence and exit */
32 #define DSF_CHECK_SYNTAX 0x00000004 /* check configuration file syntax and exit */
33 #define DSF_SHUFFLE 0x00000008 /* shuffle memory addresses within memory pool */
34 #define DSF_WAIT_ON_QUIT 0x00000010 /* wait for all cores to stop before exiting */
35 #define DSF_LISTEN_TCP 0x00000020 /* Listen on TCP port 8474 for input */
36 #define DSF_LISTEN_UDS 0x00000040 /* Listen on /tmp/prox.sock for input */
37 #define DSF_DAEMON 0x00000080 /* Run process as Daemon */
38 #define UNIQUE_MEMPOOL_PER_SOCKET 0x00000100 /* Use Only one mempool per socket, shared between all cores on that socket */
39 #define DSF_KEEP_SRC_MAC 0x00000200 /* In gen mode, do not overwrite src_mac by mac of physical port */
40 #define DSF_MP_RINGS 0x00000400 /* Use Multi Producer rings when possible */
41 #define DSF_USE_DUMMY_DEVICES 0x00000800 /* Instead of relying on real PCI devices, create null devices instead */
42 #define DSF_USE_DUMMY_CPU_TOPO 0x00001000 /* Instead of relying on the cpu topology, load a cpu toplogy that will work with all cfgs. */
43 #define DSF_DISABLE_CMT 0x00002000 /* CMT disabled */
44 #define DSF_LIST_TASK_MODES 0x00004000 /* list supported task modes and exit */
45 #define DSF_ENABLE_BYPASS 0x00008000 /* Use Multi Producer rings to enable ring bypass */
46 #define DSF_L3_ENABLED 0x00010000 /* ctrl plane enabled for IPv4 */
47 #define DSF_NDP_ENABLED 0x00020000 /* ctrl plane enabled for IPv6 */
48 #define DSF_CTRL_PLANE_ENABLED (DSF_L3_ENABLED|DSF_NDP_ENABLED) /* ctrl plane enabled */
50 #define MAX_PATH_LEN 1024
59 enum prox_ui ui; /* By default, curses is used as a UI. */
60 char update_interval_str[16];
62 uint32_t flags; /* TGSF_* flags above */
63 uint32_t master; /* master core to run user interface on */
64 uint64_t core_mask[PROX_CM_DIM]; /* Active cores without master core */
65 uint32_t start_time; /* if set (not 0), average pps will be calculated starting after start_time seconds */
66 uint32_t duration_time; /* if set (not 0), prox will exit duration_time seconds after start_time */
67 char name[MAX_NAME_SIZE];
69 char log_name[MAX_PATH_LEN];
70 int32_t cpe_table_ports[PROX_MAX_PORTS];
74 uint32_t heartbeat_timeout;
75 uint32_t poll_timeout;
76 uint64_t heartbeat_tsc;
77 struct ipv6_addr all_routers_ipv6_mcast_addr;
78 struct ipv6_addr all_nodes_ipv6_mcast_addr;
79 struct ipv6_addr random_ip;
80 prox_rte_ether_addr all_routers_mac_addr;
81 prox_rte_ether_addr all_nodes_mac_addr;
84 extern struct prox_cfg prox_cfg;
86 int prox_core_active(const uint32_t lcore_id, const int with_master);
88 /* Returns non-zero if supplied lcore_id is the last active core. The
89 first core can be found by setting *lcore_id == -1. The function is
90 indented to be used as an interator. */
91 int prox_core_next(uint32_t *lcore_id, const int with_master);
93 int prox_core_to_hex(char *dst, const size_t size, const int with_master);
95 int prox_core_to_str(char *dst, const size_t size, const int with_master);
97 void prox_core_clr(void);
99 int prox_core_set_active(const uint32_t lcore_id);
101 #endif /* __PROX_CFG_H_ */