summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/dpdk_setup_ports.py26
-rwxr-xr-xscripts/trex-cfg14
-rw-r--r--src/main_dpdk.cpp117
3 files changed, 90 insertions, 67 deletions
diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py
index ce6d2b2f..59b113ba 100755
--- a/scripts/dpdk_setup_ports.py
+++ b/scripts/dpdk_setup_ports.py
@@ -15,6 +15,7 @@ from collections import defaultdict, OrderedDict
from distutils.util import strtobool
import getpass
import subprocess
+import platform
class ConfigCreator(object):
mandatory_interface_fields = ['Slot_str', 'Device_str', 'NUMA']
@@ -243,6 +244,7 @@ class map_driver(object):
cfg_file='/etc/trex_cfg.yaml'
parent_cfg = None
dump_interfaces = None
+ no_ofed_check = None
class DpdkSetup(Exception):
pass
@@ -354,7 +356,7 @@ Other network devices
subprocess.call(cmd, stdout=my_stderr,stderr=my_stderr, shell=True)
my_stderr.close();
- def check_ofe_version (self):
+ def check_ofed_version (self):
ofed_info='/usr/bin/ofed_info'
ofed_ver= '-3.4-'
ofed_ver_show= '3.4-1'
@@ -377,7 +379,15 @@ Other network devices
print("installed OFED version is '%s' should be at least '%s' and up" % (lines[0],ofed_ver_show))
exit(-1);
-
+ def verify_ofed_os(self):
+ err_msg = 'Warning: Mellanox NICs where tested only with RedHat/CentOS 7.2\n'
+ err_msg += 'Correct usage with other Linux distributions is not guaranteed.'
+ try:
+ dist = platform.dist()
+ if dist[0] not in ('redhat', 'centos') or not dist[1].startswith('7.2'):
+ print(err_msg)
+ except Exception as e:
+ print('Error while determining OS type: %s' % e)
def load_config_file (self):
@@ -490,7 +500,10 @@ Other network devices
self.set_only_mellanox_nics()
if self.get_only_mellanox_nics():
- self.check_ofe_version ()
+ if not map_driver.no_ofed_check:
+ self.verify_ofed_os()
+ self.check_ofed_version()
+
for key in if_list:
pci_id=self.m_devices[key]['Slot_str']
self.tune_mlx5_device (pci_id)
@@ -835,10 +848,12 @@ def parse_parent_cfg (parent_cfg):
parent_parser.add_argument('-?', '-h', '--help', dest = 'help', action = 'store_true')
parent_parser.add_argument('--cfg', default='')
parent_parser.add_argument('--dump-interfaces', nargs='*', default=None)
+ parent_parser.add_argument('--no-ofed-check', action = 'store_true')
+ parent_parser.add_argument('--no-watchdog', action = 'store_true')
args, _ = parent_parser.parse_known_args(shlex.split(parent_cfg))
if args.help:
sys.exit(0)
- return (args.cfg, args.dump_interfaces)
+ return (args.cfg, args.dump_interfaces, args.no_ofed_check)
def process_options ():
parser = argparse.ArgumentParser(usage="""
@@ -955,7 +970,7 @@ To see more detailed info on interfaces (table):
map_driver.args = parser.parse_args();
if map_driver.args.parent :
- map_driver.parent_cfg, map_driver.dump_interfaces = parse_parent_cfg (map_driver.args.parent)
+ map_driver.parent_cfg, map_driver.dump_interfaces, map_driver.no_ofed_check = parse_parent_cfg (map_driver.args.parent)
if map_driver.parent_cfg != '':
map_driver.cfg_file = map_driver.parent_cfg;
if map_driver.args.cfg :
@@ -999,4 +1014,3 @@ def main ():
if __name__ == '__main__':
main()
-
diff --git a/scripts/trex-cfg b/scripts/trex-cfg
index c6f12a7e..08e1110f 100755
--- a/scripts/trex-cfg
+++ b/scripts/trex-cfg
@@ -4,7 +4,7 @@ if [ -f /etc/debian_version ]; then
OS=debian
elif [ -f /etc/redhat-release ]; then
OS=redhat
- systemctl stop firewalld.service
+ systemctl stop firewalld.service &> /dev/null
else
OS=unknown
fi
@@ -78,14 +78,6 @@ fi
# try to bind the ports from the configuration file (new DPDK)
PARENT_ARGS="$0 $@"
-if /usr/bin/python -V &> /dev/null; then
- ./dpdk_setup_ports.py --parent "$PARENT_ARGS"
-elif /usr/bin/python3 -V &> /dev/null; then
- /usr/bin/python3 dpdk_setup_ports.py --parent "$PARENT_ARGS"
-elif python -V &> /dev/null; then
- python ./dpdk_setup_ports.py --parent "$PARENT_ARGS"
-else
- echo "Could not find python to run dpdk_setup_ports.py script"
- exit 1
-fi
+source find_python.sh
+$PYTHON ./dpdk_setup_ports.py --parent "$PARENT_ARGS"
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index f8f365c8..273ec26f 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -343,7 +343,7 @@ public:
virtual int set_rcv_all(CPhyEthIF * _if, bool set_on);
};
-class CTRexExtendedDriverBase40G : public CTRexExtendedDriverBase10G {
+class CTRexExtendedDriverBase40G : public CTRexExtendedDriverBase {
public:
CTRexExtendedDriverBase40G(){
// Since we support only 128 counters per if, it is OK to configure here 4 statically.
@@ -363,6 +363,9 @@ public:
virtual void update_global_config_fdir(port_cfg_t * cfg){
}
+ virtual int get_min_sample_rate(void){
+ return (RX_CHECK_MIX_SAMPLE_RATE);
+ }
virtual void update_configuration(port_cfg_t * cfg);
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
virtual int add_del_rx_flow_stat_rule(uint8_t port_id, enum rte_filter_op op, uint16_t l3_proto
@@ -461,7 +464,7 @@ private:
};
-class CTRexExtendedDriverBaseMlnx5G : public CTRexExtendedDriverBase10G {
+class CTRexExtendedDriverBaseMlnx5G : public CTRexExtendedDriverBase {
public:
CTRexExtendedDriverBaseMlnx5G(){
}
@@ -478,6 +481,9 @@ public:
virtual void update_global_config_fdir(port_cfg_t * cfg){
}
+ virtual int get_min_sample_rate(void){
+ return (RX_CHECK_MIX_SAMPLE_RATE);
+ }
virtual void update_configuration(port_cfg_t * cfg);
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
@@ -686,6 +692,7 @@ enum { OPT_HELP,
OPT_CHECKSUM_OFFLOAD,
OPT_CLOSE,
OPT_ARP_REF_PER,
+ OPT_NO_OFED_CHECK,
};
/* these are the argument types:
@@ -695,54 +702,55 @@ enum { OPT_HELP,
*/
static CSimpleOpt::SOption parser_options[] =
{
- { OPT_HELP, "-?", SO_NONE },
- { OPT_HELP, "-h", SO_NONE },
- { OPT_HELP, "--help", SO_NONE },
- { OPT_UT, "--ut", SO_NONE },
- { OPT_MODE_BATCH, "-f", SO_REQ_SEP},
- { OPT_MODE_INTERACTIVE, "-i", SO_NONE },
- { OPT_PLAT_CFG_FILE, "--cfg", SO_REQ_SEP},
- { OPT_SINGLE_CORE, "-s", SO_NONE },
- { OPT_FLIP_CLIENT_SERVER,"--flip",SO_NONE },
- { OPT_FLOW_FLIP_CLIENT_SERVER,"-p",SO_NONE },
- { OPT_FLOW_FLIP_CLIENT_SERVER_SIDE,"-e",SO_NONE },
- { OPT_NO_CLEAN_FLOW_CLOSE,"--nc",SO_NONE },
- { OPT_LIMT_NUM_OF_PORTS,"--limit-ports", SO_REQ_SEP },
- { OPT_CORES , "-c", SO_REQ_SEP },
- { OPT_NODE_DUMP , "-v", SO_REQ_SEP },
- { OPT_DUMP_INTERFACES , "--dump-interfaces", SO_MULTI },
- { OPT_LATENCY , "-l", SO_REQ_SEP },
- { OPT_DURATION , "-d", SO_REQ_SEP },
- { OPT_PLATFORM_FACTOR , "-pm", SO_REQ_SEP },
- { OPT_PUB_DISABLE , "-pubd", SO_NONE },
- { OPT_RATE_MULT , "-m", SO_REQ_SEP },
- { OPT_LATENCY_MASK , "--lm", SO_REQ_SEP },
- { OPT_ONLY_LATENCY, "--lo", 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 },
- { OPT_RX_CHECK_HOPS, "--hops", SO_REQ_SEP },
- { OPT_IPV6, "--ipv6", SO_NONE },
- { OPT_LEARN, "--learn", SO_NONE },
- { OPT_LEARN_MODE, "--learn-mode", SO_REQ_SEP },
- { 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_CLIENT_CFG_FILE, "--client_cfg", 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_SEND_DEBUG_PKT, "--send-debug-pkt", SO_REQ_SEP },
- { OPT_MBUF_FACTOR , "--mbuf-factor", SO_REQ_SEP },
- { OPT_NO_WATCHDOG , "--no-watchdog", SO_NONE },
- { OPT_ALLOW_COREDUMP , "--allow-coredump", SO_NONE },
- { OPT_CHECKSUM_OFFLOAD, "--checksum-offload", SO_NONE },
- { OPT_CLOSE, "--close-at-end", SO_NONE },
- { OPT_ARP_REF_PER, "--arp-refresh-period", SO_REQ_SEP },
+ { OPT_HELP, "-?", SO_NONE },
+ { OPT_HELP, "-h", SO_NONE },
+ { OPT_HELP, "--help", SO_NONE },
+ { OPT_UT, "--ut", SO_NONE },
+ { OPT_MODE_BATCH, "-f", SO_REQ_SEP },
+ { OPT_MODE_INTERACTIVE, "-i", SO_NONE },
+ { OPT_PLAT_CFG_FILE, "--cfg", SO_REQ_SEP },
+ { OPT_SINGLE_CORE, "-s", SO_NONE },
+ { OPT_FLIP_CLIENT_SERVER, "--flip", SO_NONE },
+ { OPT_FLOW_FLIP_CLIENT_SERVER,"-p", SO_NONE },
+ { OPT_FLOW_FLIP_CLIENT_SERVER_SIDE, "-e", SO_NONE },
+ { OPT_NO_CLEAN_FLOW_CLOSE, "--nc", SO_NONE },
+ { OPT_LIMT_NUM_OF_PORTS, "--limit-ports", SO_REQ_SEP },
+ { OPT_CORES, "-c", SO_REQ_SEP },
+ { OPT_NODE_DUMP, "-v", SO_REQ_SEP },
+ { OPT_DUMP_INTERFACES, "--dump-interfaces", SO_MULTI },
+ { OPT_LATENCY, "-l", SO_REQ_SEP },
+ { OPT_DURATION, "-d", SO_REQ_SEP },
+ { OPT_PLATFORM_FACTOR, "-pm", SO_REQ_SEP },
+ { OPT_PUB_DISABLE, "-pubd", SO_NONE },
+ { OPT_RATE_MULT, "-m", SO_REQ_SEP },
+ { OPT_LATENCY_MASK, "--lm", SO_REQ_SEP },
+ { OPT_ONLY_LATENCY, "--lo", 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 },
+ { OPT_RX_CHECK_HOPS, "--hops", SO_REQ_SEP },
+ { OPT_IPV6, "--ipv6", SO_NONE },
+ { OPT_LEARN, "--learn", SO_NONE },
+ { OPT_LEARN_MODE, "--learn-mode", SO_REQ_SEP },
+ { 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_CLIENT_CFG_FILE, "--client_cfg", 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_SEND_DEBUG_PKT, "--send-debug-pkt", SO_REQ_SEP },
+ { OPT_MBUF_FACTOR, "--mbuf-factor", SO_REQ_SEP },
+ { OPT_NO_WATCHDOG, "--no-watchdog", SO_NONE },
+ { OPT_ALLOW_COREDUMP, "--allow-coredump", SO_NONE },
+ { OPT_CHECKSUM_OFFLOAD, "--checksum-offload", SO_NONE },
+ { OPT_CLOSE, "--close-at-end", SO_NONE },
+ { OPT_ARP_REF_PER, "--arp-refresh-period", SO_REQ_SEP },
+ { OPT_NO_OFED_CHECK, "--no-ofed-check", SO_NONE },
SO_END_OF_OPTIONS
};
@@ -793,6 +801,7 @@ static int usage(){
printf(" --nc : If set, will not wait for all flows to be closed, before terminating - see manual for more information \n");
printf(" --no-flow-control-change : By default TRex disables flow-control. If this option is given, it does not touch it \n");
printf(" --no-key : Daemon mode, don't get input from keyboard \n");
+ printf(" --no-ofed-check : Disable the check of OFED version \n");
printf(" --no-watchdog : Disable watchdog \n");
printf(" -p : Send all flow packets from the same interface (choosed randomly between client ad server ports) without changing their src/dst IP \n");
printf(" -pm : Platform factor. If you have splitter in the setup, you can multiply the total results by this factor \n");
@@ -1065,14 +1074,22 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
sscanf(args.OptionArg(),"%d", &tmp_data);
po->m_arp_ref_per=(uint16_t)tmp_data;
break;
+ case OPT_NO_OFED_CHECK:
+ break;
default:
+ printf("Error: option %s is not handled.\n\n", args.OptionText());
usage();
return -1;
break;
} // End of switch
}// End of IF
else {
+ if (args.LastError() == SO_OPT_INVALID) {
+ printf("Error: option %s is not recognized.\n\n", args.OptionText());
+ } else if (args.LastError() == SO_ARG_MISSING) {
+ printf("Error: option %s is expected to have argument.\n\n", args.OptionText());
+ }
usage();
return -1;
}