36 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0-only3 4. ./eeh-functions.sh5 6eeh_test_prep # NB: may exit7 8vf_list="$(eeh_enable_vfs)";9if $? != 0 ; then10 log "No usable VFs found. Skipping EEH unaware VF test"11 exit $KSELFTESTS_SKIP;12fi13 14log "Enabled VFs: $vf_list"15 16failed=017for vf in $vf_list ; do18 log "Testing $vf"19 20 if eeh_can_recover $vf ; then21 log "Driver for $vf supports error recovery. Unbinding..."22 echo "$vf" > /sys/bus/pci/devices/$vf/driver/unbind23 fi24 25 log "Breaking $vf..."26 if ! eeh_one_dev $vf ; then27 log "$vf failed to recover"28 failed="$((failed + 1))"29 fi30done31 32eeh_disable_vfs33 34test "$failed" != 035exit $?;36