Server IP : 104.21.38.3 / Your IP : 172.71.124.184 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/src/linux-headers-5.15.0-142/tools/testing/selftests/drivers/net/netdevsim/ |
Upload File : |
#!/bin/bash # SPDX-License-Identifier: GPL-2.0-only source ethtool-common.sh function get_value { local query="${SETTINGS_MAP[$1]}" echo $(ethtool -c $NSIM_NETDEV | \ awk -F':' -v pattern="$query:" '$0 ~ pattern {gsub(/[ \t]/, "", $2); print $2}') } function update_current_settings { for key in ${!SETTINGS_MAP[@]}; do CURRENT_SETTINGS[$key]=$(get_value $key) done echo ${CURRENT_SETTINGS[@]} } if ! ethtool -h | grep -q coalesce; then echo "SKIP: No --coalesce support in ethtool" exit 4 fi NSIM_NETDEV=$(make_netdev) set -o pipefail declare -A SETTINGS_MAP=( ["rx-frames-low"]="rx-frame-low" ["tx-frames-low"]="tx-frame-low" ["rx-frames-high"]="rx-frame-high" ["tx-frames-high"]="tx-frame-high" ["rx-usecs"]="rx-usecs" ["rx-frames"]="rx-frames" ["rx-usecs-irq"]="rx-usecs-irq" ["rx-frames-irq"]="rx-frames-irq" ["tx-usecs"]="tx-usecs" ["tx-frames"]="tx-frames" ["tx-usecs-irq"]="tx-usecs-irq" ["tx-frames-irq"]="tx-frames-irq" ["stats-block-usecs"]="stats-block-usecs" ["pkt-rate-low"]="pkt-rate-low" ["rx-usecs-low"]="rx-usecs-low" ["tx-usecs-low"]="tx-usecs-low" ["pkt-rate-high"]="pkt-rate-high" ["rx-usecs-high"]="rx-usecs-high" ["tx-usecs-high"]="tx-usecs-high" ["sample-interval"]="sample-interval" ) declare -A CURRENT_SETTINGS=( ["rx-frames-low"]="" ["tx-frames-low"]="" ["rx-frames-high"]="" ["tx-frames-high"]="" ["rx-usecs"]="" ["rx-frames"]="" ["rx-usecs-irq"]="" ["rx-frames-irq"]="" ["tx-usecs"]="" ["tx-frames"]="" ["tx-usecs-irq"]="" ["tx-frames-irq"]="" ["stats-block-usecs"]="" ["pkt-rate-low"]="" ["rx-usecs-low"]="" ["tx-usecs-low"]="" ["pkt-rate-high"]="" ["rx-usecs-high"]="" ["tx-usecs-high"]="" ["sample-interval"]="" ) declare -A EXPECTED_SETTINGS=( ["rx-frames-low"]="" ["tx-frames-low"]="" ["rx-frames-high"]="" ["tx-frames-high"]="" ["rx-usecs"]="" ["rx-frames"]="" ["rx-usecs-irq"]="" ["rx-frames-irq"]="" ["tx-usecs"]="" ["tx-frames"]="" ["tx-usecs-irq"]="" ["tx-frames-irq"]="" ["stats-block-usecs"]="" ["pkt-rate-low"]="" ["rx-usecs-low"]="" ["tx-usecs-low"]="" ["pkt-rate-high"]="" ["rx-usecs-high"]="" ["tx-usecs-high"]="" ["sample-interval"]="" ) # populate the expected settings map for key in ${!SETTINGS_MAP[@]}; do EXPECTED_SETTINGS[$key]=$(get_value $key) done # test for key in ${!SETTINGS_MAP[@]}; do value=$((RANDOM % $((2**32-1)))) ethtool -C $NSIM_NETDEV "$key" "$value" EXPECTED_SETTINGS[$key]="$value" expected=${EXPECTED_SETTINGS[@]} current=$(update_current_settings) check $? "$current" "$expected" set +x done # bool settings which ethtool displays on the same line ethtool -C $NSIM_NETDEV adaptive-rx on s=$(ethtool -c $NSIM_NETDEV | grep -q "Adaptive RX: on TX: off") check $? "$s" "" ethtool -C $NSIM_NETDEV adaptive-tx on s=$(ethtool -c $NSIM_NETDEV | grep -q "Adaptive RX: on TX: on") check $? "$s" "" if [ $num_errors -eq 0 ]; then echo "PASSED all $((num_passes)) checks" exit 0 else echo "FAILED $num_errors/$((num_errors+num_passes)) checks" exit 1 fi