403Webshell
Server IP : 13.213.54.232  /  Your IP : 216.73.217.11
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-172-31-17-110 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.1.33-67+ubuntu22.04.1+deb.sury.org+1
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/modules/6.8.0-1029-aws/build/tools/testing/selftests/drivers/net/netdevsim/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/modules/6.8.0-1029-aws/build/tools/testing/selftests/drivers/net/netdevsim/ethtool-fec.sh
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only

source ethtool-common.sh

NSIM_NETDEV=$(make_netdev)
[ a$ETHTOOL == a ] && ETHTOOL=ethtool

set -o pipefail

# Since commit 2b3ddcb35357 ("ethtool: fec: Change the prompt ...")
# in ethtool CLI the Configured lines start with Supported/Configured.
configured=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2 | head -1 | cut -d' ' -f1)

# netdevsim starts out with None/None
s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
check $? "$s" "$configured FEC encodings: None
Active FEC encoding: None"

# Test Auto
$ETHTOOL --set-fec $NSIM_NETDEV encoding auto
check $?
s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
check $? "$s" "$configured FEC encodings: Auto
Active FEC encoding: Off"

# Test case in-sensitivity
for o in off Off OFF; do
    $ETHTOOL --set-fec $NSIM_NETDEV encoding $o
    check $?
    s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
    check $? "$s" "$configured FEC encodings: Off
Active FEC encoding: Off"
done

for o in BaseR baser BAser; do
    $ETHTOOL --set-fec $NSIM_NETDEV encoding $o
    check $?
    s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
    check $? "$s" "$configured FEC encodings: BaseR
Active FEC encoding: BaseR"
done

for o in llrs rs; do
    $ETHTOOL --set-fec $NSIM_NETDEV encoding $o
    check $?
    s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
    check $? "$s" "$configured FEC encodings: ${o^^}
Active FEC encoding: ${o^^}"
done

# Test mutliple bits
$ETHTOOL --set-fec $NSIM_NETDEV encoding rs llrs
check $?
s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
check $? "$s" "$configured FEC encodings: RS LLRS
Active FEC encoding: LLRS"

$ETHTOOL --set-fec $NSIM_NETDEV encoding rs off auto
check $?
s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
check $? "$s" "$configured FEC encodings: Auto Off RS
Active FEC encoding: RS"

# Make sure other link modes are rejected
$ETHTOOL --set-fec $NSIM_NETDEV encoding FIBRE 2>/dev/null
check $? '' '' 1

$ETHTOOL --set-fec $NSIM_NETDEV encoding bla-bla-bla 2>/dev/null
check $? '' '' 1

# Try JSON
$ETHTOOL --json --show-fec $NSIM_NETDEV | jq empty >>/dev/null 2>&1
if [ $? -eq 0 ]; then
    $ETHTOOL --set-fec $NSIM_NETDEV encoding auto
    check $?

    s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].config[]')
    check $? "$s" '"Auto"'
    s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].active[]')
    check $? "$s" '"Off"'

    $ETHTOOL --set-fec $NSIM_NETDEV encoding auto RS
    check $?

    s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].config[]')
    check $? "$s" '"Auto"
"RS"'
    s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].active[]')
    check $? "$s" '"RS"'
fi

# Test error injection
echo 11 > $NSIM_DEV_DFS/ethtool/get_err

$ETHTOOL --show-fec $NSIM_NETDEV >>/dev/null 2>&1
check $? '' '' 1

echo 0 > $NSIM_DEV_DFS/ethtool/get_err
echo 11 > $NSIM_DEV_DFS/ethtool/set_err

$ETHTOOL --show-fec $NSIM_NETDEV  >>/dev/null 2>&1
check $?

$ETHTOOL --set-fec $NSIM_NETDEV encoding RS 2>/dev/null
check $? '' '' 1

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

Youez - 2016 - github.com/yon3zu
LinuXploit