#! /bin/bash if [ "$(id -u)" != 0 ]; then echo 'Error: Please run as root (sudo etc.)' exit -1 fi INPUT_ARGS=${@//[–—]/-} # replace bizarre minuses with normal one EXTRA_INPUT_ARGS="" ./trex-cfg $INPUT_ARGS RESULT=$? if [ $RESULT -eq 255 ]; then echo "ERROR encountered while configuring trex system" exit $RESULT fi if [ $RESULT -eq 32 ]; then EXTRA_INPUT_ARGS="--mlx5-so" fi pci_desc_re='^(\S+) - (.+)$' source find_python.sh while read line do if [[ "$line" =~ $pci_desc_re ]]; then pci_name="pci$(echo ${BASH_REMATCH[1]} | tr ':' '_' | tr '.' '_')" # make alphanumeric name export $pci_name="${BASH_REMATCH[2]}" fi done <<< "$($PYTHON dpdk_setup_ports.py --dump-pci-description)" cd $(dirname $0) export LD_LIBRARY_PATH=$PWD function restore_tty { stty $saveterm } if [ -t 0 ] && [ -t 1 ]; then saveterm="$(stty -g)" trap restore_tty EXIT fi # if we have a new core run optimized trex if grep -q avx /proc/cpuinfo ; then ./_$(basename $0) $INPUT_ARGS $EXTRA_INPUT_ARGS RESULT=$? if [ $RESULT -eq 132 ]; then echo " WARNING this program is optimized for the new Intel processors. " echo " try the ./t-rex-64-o application that should work for any Intel processor but might be slower. " echo " try to run t-rex-64-o .. " ./_t-rex-64-o $INPUT_ARGS $EXTRA_INPUT_ARGS RESULT=$? fi else ./_t-rex-64-o $INPUT_ARGS $EXTRA_INPUT_ARGS RESULT=$? fi exit $RESULT