Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0-only
0003 
0004 . ./eeh-functions.sh
0005 
0006 eeh_test_prep # NB: may exit
0007 
0008 vf_list="$(eeh_enable_vfs)";
0009 if $? != 0 ; then
0010         log "No usable VFs found. Skipping EEH unaware VF test"
0011         exit $KSELFTESTS_SKIP;
0012 fi
0013 
0014 log "Enabled VFs: $vf_list"
0015 
0016 failed=0
0017 for vf in $vf_list ; do
0018         log "Testing $vf"
0019 
0020         if eeh_can_recover $vf ; then
0021                 log "Driver for $vf supports error recovery. Unbinding..."
0022                 echo "$vf" > /sys/bus/pci/devices/$vf/driver/unbind
0023         fi
0024 
0025         log "Breaking $vf..."
0026         if ! eeh_one_dev $vf ; then
0027                 log "$vf failed to recover"
0028                 failed="$((failed + 1))"
0029         fi
0030 done
0031 
0032 eeh_disable_vfs
0033 
0034 test "$failed" != 0
0035 exit $?;