diff options
Diffstat (limited to 'scripts/t-rex-64')
-rwxr-xr-x | scripts/t-rex-64 | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/t-rex-64 b/scripts/t-rex-64 index 4e5c0fae..d2388cfd 100755 --- a/scripts/t-rex-64 +++ b/scripts/t-rex-64 @@ -12,12 +12,28 @@ if [ $RESULT -ne 0 ]; then exit $RESULT 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 -saveterm="$(stty -g)" + +if [ -t 0 ] && [ -t 1 ]; then + export is_tty=true + saveterm="$(stty -g)" +else + export is_tty=false +fi + # if we have a new core run optimized trex -if cat /proc/cpuinfo | grep -q avx ; then +if grep -q avx /proc/cpuinfo ; then ./_$(basename $0) $INPUT_ARGS RESULT=$? if [ $RESULT -eq 132 ]; then @@ -31,7 +47,10 @@ else ./_t-rex-64-o $INPUT_ARGS RESULT=$? fi -stty $saveterm + +if $is_tty; then + stty $saveterm +fi if [ $RESULT -ne 0 ]; then exit $RESULT |