# @name CPSW Driver Functional Tests
# @desc This file contains functional tests for CPSW ethernet driver 
# @requires net
# @setup_requires cpsw

### Ping tests ###
ETH-CPSW_XS_FUNC_PING_ALL source 'common.sh'; eth_multi_ping.sh -i 2 -d "cpsw" -a 

ETH-CPSW_S_FUNC_PING_300S_ALL source 'common.sh'; eth_multi_ping.sh -i 1 -t 300 -d "cpsw" -a 

ETH-CPSW_M_FUNC_PING_1800S_ALL source 'common.sh'; eth_multi_ping.sh -i 1 -t 1800 -d "cpsw" -a 

ETH-CPSW_M_STRESS_PING_MULTI_PKT_SIZES_ALL source 'common.sh'; for size in 128 512 1024 4096 8192 16384; do eth_multi_ping.sh -i 2 -p $size -d "cpsw" -a; done 

### Duplexity tests ###
ETH-CPSW_XS_FUNC_DUPLEX_FULL_ALL source 'common.sh'; eth_multi_duplexity.sh -i 1 -t "full" -d "cpsw" -a

ETH-CPSW_XS_FUNC_DUPLEX_HALF_ALL source 'common.sh'; eth_multi_duplexity.sh -i 1 -t "half" -d "cpsw" -a

### Speed Tests ###
ETH-CPSW_XS_FUNC_SPEED_10Mbps_ALL source 'common.sh'; eth_multi_speed.sh -i 1 -s 10 -d "cpsw" -a

ETH-CPSW_XS_FUNC_SPEED_100Mbps_ALL source 'common.sh'; eth_multi_speed.sh -i 1 -s 100 -d "cpsw" -a

ETH-CPSW_XS_FUNC_SPEED_1000Mbps_ALL source 'common.sh'; eth_multi_speed.sh -i 1 -s 1000 -d "cpsw" -a

### MAC Config test ###
ETH-CPSW_XS_FUNC_MAC_CONFIG_ALL source 'common.sh'; eth_multi_mac_config.sh -i 1 -d "cpsw" -a

### MTU Test ###
ETH-CPSW_XS_FUNC_MTU_CONFIG source 'common.sh'; iface=`get_test_iface_by_driver.sh -d "cpsw"` || die "error getting eth interface name"; do_cmd "ifconfig ${iface} mtu 512"; test_mtu=`ifconfig ${iface} | grep 512`; echo test_mtu: ${test_mtu}; do_cmd "ifconfig ${iface} mtu 1500"; if [ -z "${test_mtu}" ]; then die "MTU was not changed!"; fi; 

### CPSW Descriptor Pool Size Test ###
ETH-CPSW_S_FUNC_MODULAR_DESCRIPTORS_4096_PING source 'common.sh'; iface=`get_test_iface_by_driver.sh -d "cpsw"` || die "error getting eth interface name"; descs=`ethtool -g ${iface} | grep 2048`; echo descs: $descs;if [ -z "$descs" ]; then die "cpsw descriptors were not set to the correct values!"; fi; host=`get_eth_gateway.sh "-i ${iface}"`|| die "error getting eth gateway address"; do_cmd "ping ${host} -c 3 -I ${iface}"
