~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/netdevsim/ethtool-fec.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0-only
  3 
  4 source ethtool-common.sh
  5 
  6 NSIM_NETDEV=$(make_netdev)
  7 [ a$ETHTOOL == a ] && ETHTOOL=ethtool
  8 
  9 set -o pipefail
 10 
 11 # Since commit 2b3ddcb35357 ("ethtool: fec: Change the prompt ...")
 12 # in ethtool CLI the Configured lines start with Supported/Configured.
 13 configured=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2 | head -1 | cut -d' ' -f1)
 14 
 15 # netdevsim starts out with None/None
 16 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 17 check $? "$s" "$configured FEC encodings: None
 18 Active FEC encoding: None"
 19 
 20 # Test Auto
 21 $ETHTOOL --set-fec $NSIM_NETDEV encoding auto
 22 check $?
 23 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 24 check $? "$s" "$configured FEC encodings: Auto
 25 Active FEC encoding: Off"
 26 
 27 # Test case in-sensitivity
 28 for o in off Off OFF; do
 29     $ETHTOOL --set-fec $NSIM_NETDEV encoding $o
 30     check $?
 31     s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 32     check $? "$s" "$configured FEC encodings: Off
 33 Active FEC encoding: Off"
 34 done
 35 
 36 for o in BaseR baser BAser; do
 37     $ETHTOOL --set-fec $NSIM_NETDEV encoding $o
 38     check $?
 39     s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 40     check $? "$s" "$configured FEC encodings: BaseR
 41 Active FEC encoding: BaseR"
 42 done
 43 
 44 for o in llrs rs; do
 45     $ETHTOOL --set-fec $NSIM_NETDEV encoding $o
 46     check $?
 47     s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 48     check $? "$s" "$configured FEC encodings: ${o^^}
 49 Active FEC encoding: ${o^^}"
 50 done
 51 
 52 # Test multiple bits
 53 $ETHTOOL --set-fec $NSIM_NETDEV encoding rs llrs
 54 check $?
 55 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 56 check $? "$s" "$configured FEC encodings: RS LLRS
 57 Active FEC encoding: LLRS"
 58 
 59 $ETHTOOL --set-fec $NSIM_NETDEV encoding rs off auto
 60 check $?
 61 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2)
 62 check $? "$s" "$configured FEC encodings: Auto Off RS
 63 Active FEC encoding: RS"
 64 
 65 # Make sure other link modes are rejected
 66 $ETHTOOL --set-fec $NSIM_NETDEV encoding FIBRE 2>/dev/null
 67 check $? '' '' 1
 68 
 69 $ETHTOOL --set-fec $NSIM_NETDEV encoding bla-bla-bla 2>/dev/null
 70 check $? '' '' 1
 71 
 72 # Try JSON
 73 $ETHTOOL --json --show-fec $NSIM_NETDEV | jq empty >>/dev/null 2>&1
 74 if [ $? -eq 0 ]; then
 75     $ETHTOOL --set-fec $NSIM_NETDEV encoding auto
 76     check $?
 77 
 78     s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].config[]')
 79     check $? "$s" '"Auto"'
 80     s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].active[]')
 81     check $? "$s" '"Off"'
 82 
 83     $ETHTOOL --set-fec $NSIM_NETDEV encoding auto RS
 84     check $?
 85 
 86     s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].config[]')
 87     check $? "$s" '"Auto"
 88 "RS"'
 89     s=$($ETHTOOL --json --show-fec $NSIM_NETDEV | jq '.[].active[]')
 90     check $? "$s" '"RS"'
 91 fi
 92 
 93 # Test error injection
 94 echo 11 > $NSIM_DEV_DFS/ethtool/get_err
 95 
 96 $ETHTOOL --show-fec $NSIM_NETDEV >>/dev/null 2>&1
 97 check $? '' '' 1
 98 
 99 echo 0 > $NSIM_DEV_DFS/ethtool/get_err
100 echo 11 > $NSIM_DEV_DFS/ethtool/set_err
101 
102 $ETHTOOL --show-fec $NSIM_NETDEV  >>/dev/null 2>&1
103 check $?
104 
105 $ETHTOOL --set-fec $NSIM_NETDEV encoding RS 2>/dev/null
106 check $? '' '' 1
107 
108 if [ $num_errors -eq 0 ]; then
109     echo "PASSED all $((num_passes)) checks"
110     exit 0
111 else
112     echo "FAILED $num_errors/$((num_errors+num_passes)) checks"
113     exit 1
114 fi

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php