summaryrefslogtreecommitdiffstats
path: root/src/main_dpdk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_dpdk.cpp')
-rw-r--r--src/main_dpdk.cpp329
1 files changed, 204 insertions, 125 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 820371ab..7bff8253 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -141,8 +141,8 @@ public:
virtual int configure_drop_queue(CPhyEthIF * _if);
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats)=0;
virtual void clear_extended_stats(CPhyEthIF * _if)=0;
- virtual int wait_for_stable_link()=0;
- virtual void wait_after_link_up(){};
+ virtual int wait_for_stable_link();
+ virtual void wait_after_link_up();
virtual bool flow_control_disable_supported(){return true;}
virtual bool hw_rx_stat_supported(){return false;}
virtual int get_rx_stats(CPhyEthIF * _if, uint32_t *pkts, uint32_t *prev_pkts, uint32_t *bytes, uint32_t *prev_bytes
@@ -538,6 +538,7 @@ enum { OPT_HELP,
OPT_ONLY_LATENCY,
OPT_1G_MODE,
OPT_LATENCY_PREVIEW ,
+ OPT_WAIT_BEFORE_TRAFFIC,
OPT_PCAP,
OPT_RX_CHECK,
OPT_IO_MODE,
@@ -548,12 +549,10 @@ enum { OPT_HELP,
OPT_L_PKT_MODE,
OPT_NO_FLOW_CONTROL,
OPT_RX_CHECK_HOPS,
- OPT_MAC_FILE,
+ OPT_CLIENT_CFG_FILE,
OPT_NO_KEYBOARD_INPUT,
- OPT_VLAN,
OPT_VIRT_ONE_TX_RX_QUEUE,
OPT_PREFIX,
- OPT_MAC_SPLIT,
OPT_SEND_DEBUG_PKT,
OPT_NO_WATCHDOG,
OPT_ALLOW_COREDUMP,
@@ -602,6 +601,7 @@ static CSimpleOpt::SOption parser_options[] =
{ OPT_1G_MODE, "-1g", SO_NONE },
{ OPT_LATENCY_PREVIEW , "-k", SO_REQ_SEP },
+ { OPT_WAIT_BEFORE_TRAFFIC , "-w", SO_REQ_SEP },
{ OPT_PCAP, "--pcap", SO_NONE },
{ OPT_RX_CHECK, "--rx-check", SO_REQ_SEP },
{ OPT_IO_MODE, "--iom", SO_REQ_SEP },
@@ -612,12 +612,10 @@ static CSimpleOpt::SOption parser_options[] =
{ OPT_LEARN_VERIFY, "--learn-verify", SO_NONE },
{ OPT_L_PKT_MODE, "--l-pkt-mode", SO_REQ_SEP },
{ OPT_NO_FLOW_CONTROL, "--no-flow-control-change", SO_NONE },
- { OPT_VLAN, "--vlan", SO_NONE },
- { OPT_MAC_FILE, "--mac", SO_REQ_SEP },
+ { OPT_CLIENT_CFG_FILE, "--client_cfg", SO_REQ_SEP },
{ OPT_NO_KEYBOARD_INPUT ,"--no-key", SO_NONE },
{ OPT_VIRT_ONE_TX_RX_QUEUE, "--vm-sim", SO_NONE },
{ OPT_PREFIX, "--prefix", SO_REQ_SEP },
- { OPT_MAC_SPLIT, "--mac-spread", SO_REQ_SEP },
{ OPT_SEND_DEBUG_PKT, "--send-debug-pkt", SO_REQ_SEP },
{ OPT_MBUF_FACTOR , "--mbuf-factor", SO_REQ_SEP },
{ OPT_NO_WATCHDOG , "--no-watchdog", SO_NONE },
@@ -644,7 +642,7 @@ static int usage(){
printf(" options \n\n");
- printf(" --mac [file] : YAML file with <client ip, mac addr> configuration \n");
+ printf(" --client_cfg [file] : YAML file which describes clients configuration\n");
printf(" \n\n");
printf(" -c [number of threads] : default is 1. number of threads to allocate for each dual ports. \n");
printf(" \n");
@@ -682,6 +680,8 @@ static int usage(){
printf(" \n");
printf(" -k [sec] : run latency test before starting the test. it will wait for x sec sending packet and x sec after that \n");
printf(" \n");
+ printf(" -w [sec] : wait between init of interfaces and sending traffic, default is 1\n");
+ printf(" \n");
printf(" --cfg [platform_yaml] : load and configure platform using this file see example in cfg/cfg_examplexx.yaml file \n");
printf(" this file is used to configure/mask interfaces cores affinity and mac addr \n");
@@ -690,9 +690,10 @@ static int usage(){
printf(" --ipv6 : work in ipv6 mode\n");
printf(" --learn (deprecated). Replaced by --learn-mode. To get older behaviour, use --learn-mode 2\n");
- printf(" --learn-mode [1-2] : Work in NAT environments, learn the dynamic NAT translation and ALG \n");
- printf(" 1 Use TCP ACK in first SYN to pass NAT translation information. Will work only for TCP streams. Initial SYN packet must be present in stream.\n");
+ printf(" --learn-mode [1-3] : Work in NAT environments, learn the dynamic NAT translation and ALG \n");
+ printf(" 1 Use TCP ACK in first SYN to pass NAT translation information. Will work only for TCP streams. Initial SYN packet must be first packet in stream.\n");
printf(" 2 Add special IP option to pass NAT translation information. Will not work on certain firewalls if they drop packets with IP options\n");
+ printf(" 3 Like 1, but without support for sequence number randomization in server->clien direction. Performance (flow/second) better than 1\n");
printf(" --learn-verify : Learn the translation, but intended for verification of the mechanism in cases that NAT does not exist \n");
printf(" \n");
printf(" --l-pkt-mode [0-3] : Set mode for sending latency packets.\n");
@@ -719,8 +720,6 @@ static int usage(){
printf(" --no-key : daemon mode, don't get input from keyboard \n");
printf(" --no-flow-control-change : By default TRex disables flow-control. If this option is given, it does not touch it\n");
printf(" --prefix : for multi trex, each instance should have a different name \n");
- printf(" --mac-spread : Spread the destination mac-order by this factor. e.g 2 will generate the traffic to 2 devices DEST-MAC ,DEST-MAC+1 \n");
- printf(" maximum is up to 128 devices \n");
printf(" --mbuf-factor : factor for packet memory \n");
printf(" \n");
printf(" --no-watchdog : disable watchdog \n");
@@ -745,7 +744,7 @@ static int usage(){
printf("\n");
printf("\n");
- printf(" Copyright (c) 2015-2015 Cisco Systems, Inc. \n");
+ printf(" Copyright (c) 2015-2016 Cisco Systems, Inc. \n");
printf(" \n");
printf(" Licensed under the Apache License, Version 2.0 (the 'License') \n");
printf(" you may not use this file except in compliance with the License. \n");
@@ -830,8 +829,8 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
po->preview.set_no_keyboard(true);
break;
- case OPT_MAC_FILE :
- po->mac_file = args.OptionArg();
+ case OPT_CLIENT_CFG_FILE :
+ po->client_cfg_file = args.OptionArg();
break;
case OPT_PLAT_CFG_FILE :
@@ -846,9 +845,6 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
po->preview.set_ipv6_mode_enable(true);
break;
- case OPT_VLAN:
- po->preview.set_vlan_mode_enable(true);
- break;
case OPT_LEARN :
po->m_learn_mode = CParserOption::LEARN_MODE_IP_OPTION;
@@ -954,6 +950,10 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
sscanf(args.OptionArg(),"%d", &po->m_latency_prev);
break;
+ case OPT_WAIT_BEFORE_TRAFFIC :
+ sscanf(args.OptionArg(),"%d", &po->m_wait_before_traffic);
+ break;
+
case OPT_PCAP:
po->preview.set_pcap_mode_enable(true);
break;
@@ -980,13 +980,6 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
po->prefix = args.OptionArg();
break;
- case OPT_MAC_SPLIT:
- sscanf(args.OptionArg(),"%d", &tmp_data);
- po->m_mac_splitter = (uint8_t)tmp_data;
- po->preview.set_mac_ip_features_enable(true);
- po->preview.setDestMacSplit(true);
- break;
-
case OPT_SEND_DEBUG_PKT:
sscanf(args.OptionArg(),"%d", &tmp_data);
po->m_debug_pkt_proto = (uint8_t)tmp_data;
@@ -1014,17 +1007,9 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
parse_err("Please provide single run mode (e.g. batch or interactive)");
}
- if ( po->m_mac_splitter > 128 ){
- std::stringstream ss;
- ss << "maximum mac spreading is 128 you set it to: " << po->m_mac_splitter;
- parse_err(ss.str());
- }
-
- if ( CGlobalInfo::is_learn_mode() ){
- if ( po->preview.get_ipv6_mode_enable() ){
- parse_err("--learn mode is not supported with --ipv6, beacuse there is not such thing NAT66 ( ipv6-ipv6) \n" \
- "if you think it is important,open a defect \n");
- }
+ if (CGlobalInfo::is_learn_mode() && po->preview.get_ipv6_mode_enable()) {
+ parse_err("--learn mode is not supported with --ipv6, beacuse there is not such thing NAT66 ( ipv6-ipv6) \n" \
+ "if you think it is important,open a defect \n");
}
if (po->preview.get_is_rx_check_enable() || po->is_latency_enabled() || CGlobalInfo::is_learn_mode()) {
@@ -1777,7 +1762,9 @@ public:
virtual void flush_dp_rx_queue(void);
virtual int flush_tx_queue(void);
__attribute__ ((noinline)) void flush_rx_queue();
- __attribute__ ((noinline)) void update_mac_addr(CGenNode * node,uint8_t *p);
+ __attribute__ ((noinline)) void handle_slowpath_features(CGenNode *node, rte_mbuf_t *m, uint8_t *p, pkt_dir_t dir);
+
+ void apply_client_cfg(const ClientCfg *cfg, rte_mbuf_t *m, pkt_dir_t dir, uint8_t *p);
bool process_rx_pkt(pkt_dir_t dir,rte_mbuf_t * m);
@@ -1810,6 +1797,8 @@ protected:
rte_mbuf_t *m,
CVirtualIFPerSideStats * lp_stats);
+ void add_vlan(rte_mbuf_t *m, uint16_t vlan_id);
+
protected:
uint8_t m_core_id;
uint16_t m_mbuf_cache;
@@ -2034,27 +2023,6 @@ void CCoreEthIF::send_one_pkt(pkt_dir_t dir,
lp_port->m_len = 0;
}
-
-void CCoreEthIF::update_mac_addr(CGenNode * node,uint8_t *p){
-
- if ( CGlobalInfo::m_options.preview.getDestMacSplit() ) {
- p[5]+= (node->m_src_ip % CGlobalInfo::m_options.m_mac_splitter);
- }
-
- if ( unlikely( CGlobalInfo::m_options.preview.get_mac_ip_mapping_enable() ) ) {
- /* mac mapping file is configured
- */
- if ( node->is_initiator_pkt() && (node->m_src_mac.inused==INUSED)) {
- memcpy(p+6, &node->m_src_mac.mac, 6);
- }
- } else if ( unlikely( CGlobalInfo::m_options.preview.get_mac_ip_overide_enable() ) ){
- /* client side */
- if ( node->is_initiator_pkt() ){
- *((uint32_t*)(p+6))=PKT_NTOHL(node->m_src_ip);
- }
- }
-}
-
int CCoreEthIFStateless::send_node_flow_stat(rte_mbuf *m, CGenNodeStateless * node_sl, CCorePerPort * lp_port
, CVirtualIFPerSideStats * lp_stats, bool is_const) {
// Defining this makes 10% percent packet loss. 1% packet reorder.
@@ -2180,8 +2148,59 @@ int CCoreEthIFStateless::handle_slow_path_node(CGenNode * no) {
return (-1);
}
+void CCoreEthIF::apply_client_cfg(const ClientCfg *cfg, rte_mbuf_t *m, pkt_dir_t dir, uint8_t *p) {
+
+ assert(cfg);
+
+ /* take the right direction config */
+ const ClientCfgDir &cfg_dir = ( (dir == CLIENT_SIDE) ? cfg->m_initiator : cfg->m_responder);
+
+ /* dst mac */
+ if (cfg_dir.has_dst_mac_addr()) {
+ memcpy(p, cfg_dir.get_dst_mac_addr(), 6);
+ }
+
+ /* src mac */
+ if (cfg_dir.has_src_mac_addr()) {
+ memcpy(p + 6, cfg_dir.get_src_mac_addr(), 6);
+ }
+
+ /* VLAN */
+ if (cfg_dir.has_vlan()) {
+ add_vlan(m, cfg_dir.get_vlan());
+ }
+}
+
+
+void CCoreEthIF::add_vlan(rte_mbuf_t *m, uint16_t vlan_id) {
+ m->ol_flags = PKT_TX_VLAN_PKT;
+ m->l2_len = 14;
+ m->vlan_tci = vlan_id;
+}
+
+/**
+ * slow path features goes here (avoid multiple IFs)
+ *
+ */
+void CCoreEthIF::handle_slowpath_features(CGenNode *node, rte_mbuf_t *m, uint8_t *p, pkt_dir_t dir) {
+
+
+ /* MAC ovverride */
+ if ( unlikely( CGlobalInfo::m_options.preview.get_mac_ip_overide_enable() ) ) {
+ /* client side */
+ if ( node->is_initiator_pkt() ) {
+ *((uint32_t*)(p+6)) = PKT_NTOHL(node->m_src_ip);
+ }
+ }
+
+ /* flag is faster than checking the node pointer (another cacheline) */
+ if ( unlikely(CGlobalInfo::m_options.preview.get_is_client_cfg_enable() ) ) {
+ apply_client_cfg(node->m_client_cfg, m, dir, p);
+ }
+
+}
-int CCoreEthIF::send_node(CGenNode * node){
+int CCoreEthIF::send_node(CGenNode * node) {
if ( unlikely( node->get_cache_mbuf() !=NULL ) ) {
pkt_dir_t dir;
@@ -2199,33 +2218,30 @@ int CCoreEthIF::send_node(CGenNode * node){
rte_mbuf_t * m=lp->generate_new_mbuf(node);
pkt_dir_t dir;
- bool single_port;
+ bool single_port;
- dir = node->cur_interface_dir();
+ dir = node->cur_interface_dir();
single_port = node->get_is_all_flow_from_same_dir() ;
+
if ( unlikely( CGlobalInfo::m_options.preview.get_vlan_mode_enable() ) ){
/* which vlan to choose 0 or 1*/
uint8_t vlan_port = (node->m_src_ip &1);
-
- /* set the vlan */
- m->ol_flags = PKT_TX_VLAN_PKT;
- m->l2_len =14;
- uint16_t vlan_id = CGlobalInfo::m_options.m_vlan_port[vlan_port];
-
+ uint16_t vlan_id = CGlobalInfo::m_options.m_vlan_port[vlan_port];
if (likely( vlan_id >0 ) ) {
- m->vlan_tci = vlan_id;
dir = dir ^ vlan_port;
}else{
/* both from the same dir but with VLAN0 */
- m->vlan_tci = CGlobalInfo::m_options.m_vlan_port[0];
+ vlan_id = CGlobalInfo::m_options.m_vlan_port[0];
dir = dir ^ 0;
}
+
+ add_vlan(m, vlan_id);
}
- CCorePerPort * lp_port=&m_ports[dir];
- CVirtualIFPerSideStats * lp_stats = &m_stats[dir];
+ CCorePerPort *lp_port = &m_ports[dir];
+ CVirtualIFPerSideStats *lp_stats = &m_stats[dir];
if (unlikely(m==0)) {
lp_stats->m_tx_alloc_error++;
@@ -2233,19 +2249,17 @@ int CCoreEthIF::send_node(CGenNode * node){
}
/* update mac addr dest/src 12 bytes */
- uint8_t *p=rte_pktmbuf_mtod(m, uint8_t*);
- uint8_t p_id=lp_port->m_port->get_port_id();
-
-
+ uint8_t *p = rte_pktmbuf_mtod(m, uint8_t*);
+ uint8_t p_id = lp_port->m_port->get_port_id();
+
memcpy(p,CGlobalInfo::m_options.get_dst_src_mac_addr(p_id),12);
- /* if customer enables both mac_file and get_mac_ip_overide,
- * we will apply mac_file.
- */
- if ( unlikely(CGlobalInfo::m_options.preview.get_mac_ip_features_enable() ) ) {
- update_mac_addr(node,p);
+ /* when slowpath features are on */
+ if ( unlikely( CGlobalInfo::m_options.preview.get_is_slowpath_features_on() ) ) {
+ handle_slowpath_features(node, m, p, dir);
}
+
if ( unlikely( node->is_rx_check_enabled() ) ) {
lp_stats->m_tx_rx_check_pkt++;
lp->do_generate_new_mbuf_rxcheck(m, node, single_port);
@@ -2446,8 +2460,10 @@ public:
uint64_t m_active_sockets;
uint64_t m_total_nat_time_out;
+ uint64_t m_total_nat_time_out_wait_ack;
uint64_t m_total_nat_no_fid ;
uint64_t m_total_nat_active ;
+ uint64_t m_total_nat_syn_wait;
uint64_t m_total_nat_open ;
uint64_t m_total_nat_learn_error ;
@@ -2468,6 +2484,7 @@ public:
float m_active_flows;
float m_open_flows;
float m_cpu_util;
+ float m_cpu_util_raw;
float m_rx_cpu_util;
float m_bw_per_core;
uint8_t m_threads;
@@ -2477,7 +2494,7 @@ public:
public:
void Dump(FILE *fd,DumpFormat mode);
void DumpAllPorts(FILE *fd);
- void dump_json(std::string & json, bool baseline,uint32_t stats_tick);
+ void dump_json(std::string & json, bool baseline);
private:
std::string get_field(std::string name,float &f);
std::string get_field(std::string name,uint64_t &f);
@@ -2517,7 +2534,7 @@ std::string CGlobalStats::get_field_port(int port,std::string name,uint64_t &f){
}
-void CGlobalStats::dump_json(std::string & json, bool baseline,uint32_t stats_tick){
+void CGlobalStats::dump_json(std::string & json, bool baseline){
/* refactor this to JSON */
json="{\"name\":\"trex-global\",\"type\":0,";
@@ -2535,6 +2552,7 @@ void CGlobalStats::dump_json(std::string & json, bool baseline,uint32_t stats_ti
#define GET_FIELD_PORT(p,f) get_field_port(p,std::string(#f),lp->f)
json+=GET_FIELD(m_cpu_util);
+ json+=GET_FIELD(m_cpu_util_raw);
json+=GET_FIELD(m_bw_per_core);
json+=GET_FIELD(m_rx_cpu_util);
json+=GET_FIELD(m_platform_factor);
@@ -2564,8 +2582,10 @@ void CGlobalStats::dump_json(std::string & json, bool baseline,uint32_t stats_ti
json+=GET_FIELD(m_socket_util);
json+=GET_FIELD(m_total_nat_time_out);
+ json+=GET_FIELD(m_total_nat_time_out_wait_ack);
json+=GET_FIELD(m_total_nat_no_fid );
json+=GET_FIELD(m_total_nat_active );
+ json+=GET_FIELD(m_total_nat_syn_wait);
json+=GET_FIELD(m_total_nat_open );
json+=GET_FIELD(m_total_nat_learn_error);
@@ -2584,10 +2604,6 @@ void CGlobalStats::dump_json(std::string & json, bool baseline,uint32_t stats_ti
json+=GET_FIELD_PORT(i,m_total_rx_pps);
}
json+=m_template.dump_as_json("template");
- if ( stats_tick %4==0){
- json+=CGlobalInfo::dump_pool_as_json(); /* no need a feq update beacuse it trash the cores D cache, once in 2 sec */
- }
-
json+="\"unknown\":0}}" ;
}
@@ -2605,7 +2621,12 @@ void CGlobalStats::DumpAllPorts(FILE *fd){
fprintf (fd," Platform_factor : %2.1f \n",m_platform_factor);
fprintf (fd," Total-Tx : %s ",double_to_human_str(m_tx_bps,"bps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Nat_time_out : %8llu \n", (unsigned long long)m_total_nat_time_out);
+ fprintf (fd," NAT time out : %8llu", (unsigned long long)m_total_nat_time_out);
+ if (CGlobalInfo::is_learn_mode(CParserOption::LEARN_MODE_TCP_ACK)) {
+ fprintf (fd," (%llu in wait for syn+ack)\n", (unsigned long long)m_total_nat_time_out_wait_ack);
+ } else {
+ fprintf (fd, "\n");
+ }
}else{
fprintf (fd,"\n");
}
@@ -2613,28 +2634,33 @@ void CGlobalStats::DumpAllPorts(FILE *fd){
fprintf (fd," Total-Rx : %s ",double_to_human_str(m_rx_bps,"bps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Nat_no_fid : %8llu \n", (unsigned long long)m_total_nat_no_fid);
+ fprintf (fd," NAT aged flow id: %8llu \n", (unsigned long long)m_total_nat_no_fid);
}else{
fprintf (fd,"\n");
}
fprintf (fd," Total-PPS : %s ",double_to_human_str(m_tx_pps,"pps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Total_nat_active: %8llu \n", (unsigned long long)m_total_nat_active);
+ fprintf (fd," Total NAT active: %8llu", (unsigned long long)m_total_nat_active);
+ if (CGlobalInfo::is_learn_mode(CParserOption::LEARN_MODE_TCP_ACK)) {
+ fprintf (fd," (%llu waiting for syn)\n", (unsigned long long)m_total_nat_syn_wait);
+ } else {
+ fprintf (fd, "\n");
+ }
}else{
fprintf (fd,"\n");
}
fprintf (fd," Total-CPS : %s ",double_to_human_str(m_tx_cps,"cps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_mode() ) {
- fprintf (fd," Total_nat_open : %8llu \n", (unsigned long long)m_total_nat_open);
+ fprintf (fd," Total NAT opened: %8llu \n", (unsigned long long)m_total_nat_open);
}else{
fprintf (fd,"\n");
}
fprintf (fd,"\n");
fprintf (fd," Expected-PPS : %s ",double_to_human_str(m_tx_expected_pps,"pps",KBYE_1000).c_str());
if ( CGlobalInfo::is_learn_verify_mode() ) {
- fprintf (fd," Nat_learn_errors: %8llu \n", (unsigned long long)m_total_nat_learn_error);
+ fprintf (fd," NAT learn errors: %8llu \n", (unsigned long long)m_total_nat_learn_error);
}else{
fprintf (fd,"\n");
}
@@ -3381,7 +3407,9 @@ int CGlobalTRex::ixgbe_prob_init(void){
if ( !CTRexExtendedDriverDb::Ins()->is_driver_exists(dev_info.driver_name) ){
- printf(" ERROR driver name %s is not supported \n",dev_info.driver_name);
+ printf(" Error: driver %s is not supported. Please consult the documentation for a list of supported drivers\n"
+ ,dev_info.driver_name);
+ exit(1);
}
int i;
@@ -3604,6 +3632,7 @@ void CGlobalTRex::get_stats(CGlobalStats & stats){
stats.m_num_of_ports = m_max_ports;
stats.m_cpu_util = m_fl.GetCpuUtil();
+ stats.m_cpu_util_raw = m_fl.GetCpuUtilRaw();
if (get_is_stateless()) {
stats.m_rx_cpu_util = m_rx_sl.get_cpu_util();
}
@@ -3655,8 +3684,10 @@ void CGlobalTRex::get_stats(CGlobalStats & stats){
uint64_t total_nat_time_out =0;
+ uint64_t total_nat_time_out_wait_ack =0;
uint64_t total_nat_no_fid =0;
uint64_t total_nat_active =0;
+ uint64_t total_nat_syn_wait = 0;
uint64_t total_nat_open =0;
uint64_t total_nat_learn_error=0;
@@ -3685,8 +3716,10 @@ void CGlobalTRex::get_stats(CGlobalStats & stats){
total_sockets += lpt->m_smart_gen.MaxSockets();
total_nat_time_out +=lpt->m_stats.m_nat_flow_timeout;
+ total_nat_time_out_wait_ack += lpt->m_stats.m_nat_flow_timeout_wait_ack;
total_nat_no_fid +=lpt->m_stats.m_nat_lookup_no_flow_id ;
total_nat_active +=lpt->m_stats.m_nat_lookup_add_flow_id - lpt->m_stats.m_nat_lookup_remove_flow_id;
+ total_nat_syn_wait += lpt->m_stats.m_nat_lookup_add_flow_id - lpt->m_stats.m_nat_lookup_wait_ack_state;
total_nat_open +=lpt->m_stats.m_nat_lookup_add_flow_id;
total_nat_learn_error +=lpt->m_stats.m_nat_flow_learn_error;
uint8_t port0 = lpt->getDualPortId() *2;
@@ -3708,8 +3741,10 @@ void CGlobalTRex::get_stats(CGlobalStats & stats){
}
stats.m_total_nat_time_out = total_nat_time_out;
+ stats.m_total_nat_time_out_wait_ack = total_nat_time_out_wait_ack;
stats.m_total_nat_no_fid = total_nat_no_fid;
stats.m_total_nat_active = total_nat_active;
+ stats.m_total_nat_syn_wait = total_nat_syn_wait;
stats.m_total_nat_open = total_nat_open;
stats.m_total_nat_learn_error = total_nat_learn_error;
@@ -3835,7 +3870,7 @@ CGlobalTRex::publish_async_data(bool sync_now, bool baseline) {
get_stats(m_stats);
}
- m_stats.dump_json(json, baseline,m_stats_cnt);
+ m_stats.dump_json(json, baseline);
m_zmq_publisher.publish_json(json);
/* generator json , all cores are the same just sample the first one */
@@ -3929,7 +3964,7 @@ CGlobalTRex::handle_slow_path(bool &was_stopped) {
if (m_io_modes.m_g_mode == CTrexGlobalIoMode::gMem) {
if ( m_stats_cnt%4==0) {
- fprintf (stdout," %s \n",CGlobalInfo::dump_pool_as_json().c_str());
+ fprintf (stdout," %s \n",CGlobalInfo::dump_pool_as_json_str().c_str());
}
}
@@ -3967,9 +4002,17 @@ CGlobalTRex::handle_slow_path(bool &was_stopped) {
m_mg.DumpRxCheck(stdout);
break;
}
-
}
-
+ }
+ }
+ if ( m_io_modes.m_g_mode == CTrexGlobalIoMode::gNAT ) {
+ if ( m_io_modes.m_nat_mode == CTrexGlobalIoMode::natENABLE ) {
+ if (CGlobalInfo::is_learn_mode(CParserOption::LEARN_MODE_TCP_ACK)) {
+ fprintf(stdout, "NAT flow table info\n");
+ m_mg.dump_nat_flow_table(stdout);
+ } else {
+ fprintf(stdout, "\nThis is only relevant in --learn-mode %d\n", CParserOption::LEARN_MODE_TCP_ACK);
+ }
}
}
@@ -4221,12 +4264,24 @@ int CGlobalTRex::start_master_statefull() {
m_fl.Create();
m_fl.load_from_yaml(CGlobalInfo::m_options.cfg_file,get_cores_tx());
- if (CGlobalInfo::m_options.mac_file != "") {
- CGlobalInfo::m_options.preview.set_mac_ip_mapping_enable(true);
- m_fl.load_from_mac_file(CGlobalInfo::m_options.mac_file);
- m_fl.m_mac_info.set_configured(true);
- } else {
- m_fl.m_mac_info.set_configured(false);
+
+ /* client config */
+ if (CGlobalInfo::m_options.client_cfg_file != "") {
+ try {
+ m_fl.load_client_config_file(CGlobalInfo::m_options.client_cfg_file);
+ } catch (const std::runtime_error &e) {
+ std::cout << "\n*** " << e.what() << "\n\n";
+ exit(-1);
+ }
+ CGlobalInfo::m_options.preview.set_client_cfg_enable(true);
+ }
+
+ /* verify options */
+ try {
+ CGlobalInfo::m_options.verify();
+ } catch (const std::runtime_error &e) {
+ std::cout << "\n*** " << e.what() << "\n\n";
+ exit(-1);
}
m_expected_pps = m_fl.get_total_pps();
@@ -4860,6 +4915,18 @@ int main_test(int argc , char * argv[]){
return (0);
}
+void wait_x_sec(int sec) {
+ int i;
+ printf(" wait %d sec ", sec);
+ fflush(stdout);
+ for (i=0; i<sec; i++) {
+ delay(1000);
+ printf(".");
+ fflush(stdout);
+ }
+ printf("\n");
+ fflush(stdout);
+}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -4870,32 +4937,28 @@ int CTRexExtendedDriverBase::configure_drop_queue(CPhyEthIF * _if) {
return (rte_eth_dev_rx_queue_stop(port_id, 0));
}
+int CTRexExtendedDriverBase::wait_for_stable_link() {
+ wait_x_sec(CGlobalInfo::m_options.m_wait_before_traffic);
+ return 0;
+}
+
+void CTRexExtendedDriverBase::wait_after_link_up() {
+ wait_x_sec(CGlobalInfo::m_options.m_wait_before_traffic);
+}
+
CFlowStatParser *CTRexExtendedDriverBase::get_flow_stat_parser() {
CFlowStatParser *parser = new CFlowStatParser();
assert (parser);
return parser;
}
-void wait_x_sec(int sec) {
- int i;
- printf(" wait %d sec ", sec);
- fflush(stdout);
- for (i=0; i<sec; i++) {
- delay(1000);
- printf(".");
- fflush(stdout);
- }
- printf("\n");
- fflush(stdout);
-}
-
// in 1G we need to wait if links became ready to soon
void CTRexExtendedDriverBase1G::wait_after_link_up(){
- wait_x_sec(7);
+ wait_x_sec(6 + CGlobalInfo::m_options.m_wait_before_traffic);
}
int CTRexExtendedDriverBase1G::wait_for_stable_link(){
- wait_x_sec(10);
+ wait_x_sec(9 + CGlobalInfo::m_options.m_wait_before_traffic);
return(0);
}
@@ -5277,7 +5340,7 @@ void CTRexExtendedDriverBase10G::get_extended_stats(CPhyEthIF * _if,CPhyEthIFSta
}
int CTRexExtendedDriverBase10G::wait_for_stable_link(){
- delay(2000);
+ wait_x_sec(1 + CGlobalInfo::m_options.m_wait_before_traffic);
return (0);
}
@@ -5531,11 +5594,10 @@ void CTRexExtendedDriverBase40G::get_extended_stats(CPhyEthIF * _if,CPhyEthIFSta
stats->f_ibytes = 0;
- stats->ierrors = stats1.ierrors + stats1.imissed + stats1.ibadcrc +
+ stats->ierrors = stats1.imissed + stats1.ibadcrc +
stats1.ibadlen +
stats1.ierrors +
stats1.oerrors +
- stats1.imcasts +
stats1.rx_nombuf +
stats1.tx_pause_xon +
stats1.rx_pause_xon +
@@ -5550,7 +5612,7 @@ void CTRexExtendedDriverBase40G::get_extended_stats(CPhyEthIF * _if,CPhyEthIFSta
}
int CTRexExtendedDriverBase40G::wait_for_stable_link(){
- delay(2000);
+ wait_x_sec(1 + CGlobalInfo::m_options.m_wait_before_traffic);
return (0);
}
@@ -5605,11 +5667,10 @@ void CTRexExtendedDriverBase1GVm::get_extended_stats(CPhyEthIF * _if,CPhyEthIFSt
stats->f_ibytes = 0;
- stats->ierrors = stats1.ierrors + stats1.imissed + stats1.ibadcrc +
+ stats->ierrors = stats1.imissed + stats1.ibadcrc +
stats1.ibadlen +
stats1.ierrors +
stats1.oerrors +
- stats1.imcasts +
stats1.rx_nombuf +
stats1.tx_pause_xon +
stats1.rx_pause_xon +
@@ -5624,7 +5685,7 @@ void CTRexExtendedDriverBase1GVm::get_extended_stats(CPhyEthIF * _if,CPhyEthIFSt
}
int CTRexExtendedDriverBase1GVm::wait_for_stable_link(){
- delay(10);
+ wait_x_sec(CGlobalInfo::m_options.m_wait_before_traffic);
return (0);
}
@@ -5782,6 +5843,10 @@ int TrexDpdkPlatformApi::get_rfc2544_info(void *rfc2544_info, int min, int max,
return g_trex.m_rx_sl.get_rfc2544_info((rfc2544_info_t *)rfc2544_info, min, max, reset);
}
+int TrexDpdkPlatformApi::get_rx_err_cntrs(void *rx_err_cntrs) const {
+ return g_trex.m_rx_sl.get_rx_err_cntrs((CRxCoreErrCntrs *)rx_err_cntrs);
+}
+
int TrexDpdkPlatformApi::reset_hw_flow_stats(uint8_t port_id) const {
return g_trex.m_ports[port_id].reset_hw_flow_stats();
}
@@ -5812,6 +5877,20 @@ int TrexDpdkPlatformApi::get_active_pgids(flow_stat_active_t &result) const {
return g_trex.m_trex_stateless->m_rx_flow_stat.get_active_pgids(result);
}
+int TrexDpdkPlatformApi::get_cpu_util_full(cpu_util_full_t &cpu_util_full) const {
+ cpu_util_full.resize((int)g_trex.m_fl.m_threads_info.size());
+ for (int thread_id=0; thread_id<(int)g_trex.m_fl.m_threads_info.size(); thread_id++) {
+ CFlowGenListPerThread * lp=g_trex.m_fl.m_threads_info[thread_id];
+ lp->m_cpu_cp_u.GetHistory(cpu_util_full[thread_id]);
+ }
+ return 0;
+}
+
+int TrexDpdkPlatformApi::get_mbuf_util(Json::Value &mbuf_pool) const {
+ CGlobalInfo::dump_pool_as_json(mbuf_pool);
+ return 0;
+}
+
CFlowStatParser *TrexDpdkPlatformApi::get_flow_stat_parser() const {
return CTRexExtendedDriverDb::Ins()->get_drv()->get_flow_stat_parser();
}