2 // Copyright (c) 2010-2017 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.
22 #include "prox_globals.h"
24 #define PROX_CM_STR_LEN (2 + 2 * sizeof(prox_cfg.core_mask) + 1)
25 #define PROX_CM_DIM (RTE_MAX_LCORE/(sizeof(uint64_t) * 8))
27 #define DSF_AUTOSTART 0x00000001 /* start all cores automatically */
28 #define DSF_CHECK_INIT 0x00000002 /* check initialization sequence and exit */
29 #define DSF_CHECK_SYNTAX 0x00000004 /* check configuration file syntax and exit */
30 #define DSF_SHUFFLE 0x00000008 /* shuffle memory addresses within memory pool */
31 #define DSF_WAIT_ON_QUIT 0x00000010 /* wait for all cores to stop before exiting */
32 #define DSF_LISTEN_TCP 0x00000020 /* Listen on TCP port 8474 for input */
33 #define DSF_LISTEN_UDS 0x00000040 /* Listen on /tmp/prox.sock for input */
34 #define DSF_DAEMON 0x00000080 /* Run process as Daemon */
35 #define UNIQUE_MEMPOOL_PER_SOCKET 0x00000100 /* Use Only one mempool per socket, shared between all cores on that socket */
36 #define DSF_KEEP_SRC_MAC 0x00000200 /* In gen mode, do not overwrite src_mac by mac of physical port */
37 #define DSF_MP_RINGS 0x00000400 /* Use Multi Producer rings when possible */
38 #define DSF_USE_DUMMY_DEVICES 0x00000800 /* Instead of relying on real PCI devices, create null devices instead */
39 #define DSF_USE_DUMMY_CPU_TOPO 0x00001000 /* Instead of relying on the cpu topology, load a cpu toplogy that will work with all cfgs. */
40 #define DSF_DISABLE_CMT 0x00002000 /* CMT disabled */
41 #define DSF_LIST_TASK_MODES 0x00004000 /* list supported task modes and exit */
42 #define DSF_ENABLE_BYPASS 0x00008000 /* Use Multi Producer rings to enable ring bypass */
43 #define DSF_CTRL_PLANE_ENABLED 0x00010000 /* ctrl plane enabled */
45 #define MAX_PATH_LEN 1024
54 enum prox_ui ui; /* By default, curses is used as a UI. */
55 char update_interval_str[16];
57 uint32_t flags; /* TGSF_* flags above */
58 uint32_t master; /* master core to run user interface on */
59 uint64_t core_mask[PROX_CM_DIM]; /* Active cores without master core */
60 uint32_t start_time; /* if set (not 0), average pps will be calculated starting after start_time seconds */
61 uint32_t duration_time; /* if set (not 0), prox will exit duration_time seconds after start_time */
62 char name[MAX_NAME_SIZE];
64 char log_name[MAX_PATH_LEN];
65 int32_t cpe_table_ports[PROX_MAX_PORTS];
71 extern struct prox_cfg prox_cfg;
73 int prox_core_active(const uint32_t lcore_id, const int with_master);
75 /* Returns non-zero if supplied lcore_id is the last active core. The
76 first core can be found by setting *lcore_id == -1. The function is
77 indented to be used as an interator. */
78 int prox_core_next(uint32_t *lcore_id, const int with_master);
80 int prox_core_to_hex(char *dst, const size_t size, const int with_master);
82 int prox_core_to_str(char *dst, const size_t size, const int with_master);
84 void prox_core_clr(void);
86 int prox_core_set_active(const uint32_t lcore_id);
88 #endif /* __PROX_CFG_H_ */