# @name Ethernet performance using IPERF
# @desc Run Iperf as a server in a host PC and as a client in the target machine
# Test different window sizes, from 8K to 128K with INT pacing enabled
# @requires net/ti_cpsw
# TODO: don't hardcode eth0 here. may move ethtool command to script

ETH_S_PERF_IPERF_TCP_INTPACING_8K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface"; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 1500 -f M --bidir -t 60 -w 8K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_16K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 60 -w 16K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_32K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 60 -w 32K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_64K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 60 -w 64K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_128K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 60 -w 128K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_256K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 60 -w 256K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_M_PERF_IPERF_TCP_INTPACING_256K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 3600 -w 256K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_L_PERF_IPERF_TCP_INTPACING_256K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M --bidir -t 14400 -w 256K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"

ETH_S_PERF_IPERF_TCP_INTPACING_8K_76B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 88 -f M --bidir -t 60 -w 8K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_16K_76B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 88 -f M --bidir -t 60 -w 16K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_32K_76B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 88 -f M --bidir -t 60 -w 32K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_64K_76B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 88 -f M --bidir -t 60 -w 64K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_128K_76B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 88 -f M --bidir -t 60 -w 128K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_256K_76B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 88 -f M --bidir -t 60 -w 256K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"

ETH_S_PERF_IPERF_TCP_INTPACING_8K_200B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 212 -f M --bidir -t 60 -w 8K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_16K_200B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 212 -f M --bidir -t 60 -w 16K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_32K_200B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 212 -f M --bidir -t 60 -w 32K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_64K_200B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 212 -f M --bidir -t 60 -w 64K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_128K_200B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 212 -f M --bidir -t 60 -w 128K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_INTPACING_256K_200B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 212 -f M --bidir -t 60 -w 256K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"

ETH_S_PERF_IPERF_TCP_UNI_INTPACING_8K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface"; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -M 1500 -f M -t 60 -w 8K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_UNI_INTPACING_16K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M -t 60 -w 16K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_UNI_INTPACING_32K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M -t 60 -w 32K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_UNI_INTPACING_64K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M -t 60 -w 64K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_UNI_INTPACING_128K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M -t 60 -w 128K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
ETH_S_PERF_IPERF_TCP_UNI_INTPACING_256K_1448B source 'common.sh'; iface=`get_eth_iface_name.sh` || die "error getting eth interface name: $iface";  do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n `get_eth_coalesce_parameter.sh`"; run_iperf.sh -v 3 -- -f M -t 60 -w 256K; do_cmd "set_ethtool_coalesce_options.sh -d $iface -p 'rx-usecs' -n 16"
