struct tapi_trex_opt
Overview
Specific TRex options. More…
#include <tapi_trex.h> struct tapi_trex_opt { // fields te_log_level stdout_log_level; te_log_level stderr_log_level; bool astf_server_only; tapi_job_opt_uint_t n_threads; bool tso_disable; bool lro_disable; tapi_job_opt_double_t duration; bool asymmetric_traffic_flow; bool use_hdr_histograms; bool ipv6; tapi_job_opt_uint_t rate_multiplier; bool force_close_at_end; bool enable_flow_control; bool no_watchdog; bool use_realtime_prio; bool no_monitors; bool dont_resend_pkts; bool use_sleep; tapi_trex_verbose_t verbose; tapi_trex_iom_t iom; tapi_trex_so_t so; tapi_job_opt_uint_t init_wait_sec; const char* instance_prefix; tapi_trex_client_config** clients; tapi_trex_server_config** servers; const char* cfg_template; const te_kvpair_h* astf_vars; const char* driver; const char* astf_template; const char* trex_exec; };
Detailed Documentation
Specific TRex options.
Before starting tapi_trex it is necessary to initialize its options tapi_trex_opt
and call tapi_trex_create() to create configuration files and properly bind PCI functions (if DPDK is used).
Base tapi_trex_opt
example:
tapi_trex_opt trex_opt = tapi_trex_default_opt; trex_opt.astf_template = getenv("TE_TREX_ASTF_TEMPLATE"); trex_opt.trex_exec = getenv("TE_TREX_EXEC"); trex_opt.force_close_at_end = true; trex_opt.no_monitors = true; trex_opt.lro_disable = true; // Setup servers trex_opt.servers = TAPI_TREX_SERVERS( TAPI_TREX_SERVER( .common.interface = TAPI_TREX_PCI_BY_IFACE("Agt_A", "eth0"), .common.ip = agtA_addr, .common.gw = agtB_addr, .common.ip_range_beg = agtA_addr, .common.ip_range_end = agtA_addr, .common.payload = "HTTP/1.1 200 OK\r\n" "Content-Type: text/html\r\nConnection: keep-alive\r\n" "Content-Length: 18\r\n\r\n<html>Hello</html>" )); // Setup clients trex_opt.clients = ...;
Fields
te_log_level stdout_log_level
Standard output logging level (default is TE_LL_RING
).
te_log_level stderr_log_level
Standard error logging level (default is TE_LL_WARN
).
bool astf_server_only
If set, only server side ports (e.g. 1
, 3
and etc.) are enabled with ASTF service. Traffic won’t be transmitted on clients ports.
tapi_job_opt_uint_t n_threads
Number of hardware threads to allocate for each port pair. Overrides the 'c'
argument from config file.
bool tso_disable
If set, disable TSO (advanced TCP mode).
bool lro_disable
If set, disable LRO (advanced TCP mode).
tapi_job_opt_double_t duration
Duration of the test, in seconds.
See also:
tapi_trex_opt::force_close_at_end option.
bool asymmetric_traffic_flow
If set, each flow will be sent both from client to server and server to client. It can achieve better port utilization when flow traffic is asymmetric.
bool use_hdr_histograms
If set, report latency using high dynamic range histograms.
bool ipv6
If set, work in IPv6 mode.
tapi_job_opt_uint_t rate_multiplier
Rate multiplier. Multiply basic rate of templates by this number.
bool force_close_at_end
If set, won’t wait for all flows to be closed, before terminating.
bool enable_flow_control
If set, enable flow-control. By default TRex disables flow-control. If this option is given, it does not touch it
bool no_watchdog
If set, disable watchdog.
bool use_realtime_prio
If set, run TRex DP/RX cores in realtime priority.
bool no_monitors
If set, disable monitors publishers.
bool dont_resend_pkts
If set, don’t retry to send packets on failure (queue full etc.).
bool use_sleep
If set, use sleeps instead of busy wait in scheduler. Less accurate, more power saving.
tapi_trex_verbose_t verbose
The higher the value, print more debug information.
tapi_trex_iom_t iom
IO mode for server output.
tapi_trex_so_t so
Activate one of the *-so options.
tapi_job_opt_uint_t init_wait_sec
Wait a few seconds between init of interfaces and sending traffic.
const char* instance_prefix
For running multi TRex instances on the same machine. Each instance should have different name.
tapi_trex_client_config** clients
TRex client configurations list. Like tapi_trex_client_config*
[]. Should end with NULL
.
tapi_trex_server_config** servers
TRex server configurations list. Like tapi_trex_server_config*
[]. Should end with NULL
.
const char* cfg_template
TRex configuration template.
If NULL
, the template from this example will be used:
- port_limit : ${#IFACES}\n" version : 2\n" interfaces: [${IFACES[, ]}]\n" port_info:\n" ${PORTINFO_IP* - ip${COLON} ${PORTINFO_IP[${}]}\n" default_gw${COLON} ${PORTINFO_DEFAULT_GW[${}]}\n}" ${PORTINFO_DST_MAC* - dest_mac${COLON} ${PORTINFO_DST_MAC[${}]}\n" src_mac${COLON} ${PORTINFO_SRC_MAC[${}]}\n}";
const te_kvpair_h* astf_vars
Extensions for tapi_trex_opt::astf_template
. You can replace some fields with TAPI TRex environment variables.
The following field names are currently reserved and it’s not recommended to use them in this option:
CLIENT_HTTP
SERVER_HTTP
CLIENT_IP_START
CLIENT_IP_START
CLIENT_IP_END
CLIENT_IP_OFFSET
SERVER_IP_START
SERVER_IP_END
SERVER_IP_OFFSET
CLIENT_IP_PORT
SERVER_IP_PORT
See also:
const char* driver
Driver name for DPDK binding. Should be NULL
if interface is already bound.
const char* astf_template
TRex ASTF template.
Now TAPI TRex supports only JSON profile templates. To create JSON profile template you need to use existing Python traffic profile and use this command to see JSON profile:
./astf-sim -f <your_profile>.py --json
Example:
./astf-sim -f astf/http_simple.py --json
Use this JSON profile to create TAPI TRex ASTF template (tapi_trex_opt::astf_template
). You can replace some fields with TAPI TRex environment variables using tapi_trex_opt::extensions
.
Fields usage see te_string_expand_kvpairs
for more details.
Example of JSON profile template:
{ "buf_list": [ "${CLIENT_HTTP[0]|base64uri}", "${SERVER_HTTP[0]|base64uri}" ], "ip_gen_dist_list": [ { "ip_start": "${CLIENT_IP_START[0]:-0.0.0.0}", "ip_end": "${CLIENT_IP_END[0]:-0.0.0.0}", "distribution": "seq", "dir": "c", "ip_offset": "${CLIENT_IP_OFFSET[0]:-0.0.0.0}" }, { "ip_start": "${SERVER_IP_START[0]:-0.0.0.0}", "ip_end": "${SERVER_IP_END[0]:-0.0.0.0}", "distribution": "seq", "dir": "s", "ip_offset": "${SERVER_IP_OFFSET[0]:-0.0.0.0}" } ], "program_list": [ { "commands": [ { "name": "connect" }, { "name": "tx", "buf_index": 0 }, { "name": "rx", "min_bytes": 10 }, { "name": "delay", "usec": 1000 } ] }, { "commands": [ { "name": "connect" }, { "name": "rx", "min_bytes": 10 }, { "name": "tx", "buf_index": 1 } ] } ], "templates": [ { "client_template": { "program_index": 0, "ip_gen": { "dist_client": { "index": 0 }, "dist_server": { "index": 1 } }, "cluster": {}, "port": ${CLIENT_IP_PORT[0]:-80}, "cps": 1 }, "server_template": { "program_index": 1, "assoc": [ { "port": ${SERVER_IP_PORT[0]:-80} } ] } } ], "tg_names": [] }
See also:
const char* trex_exec
Full path to TRex exec (should not be NULL
). The directory with TRex exec should also contain "astf_schema.json"
.