• Radoslaw Tyl's avatar
    iavf: do not process adminq tasks when __IAVF_IN_REMOVE_TASK is set · c8de44b5
    Radoslaw Tyl authored
    Prevent schedule operations for adminq during device remove and when
    __IAVF_IN_REMOVE_TASK flag is set. Currently, the iavf_down function
    adds operations for adminq that shouldn't be processed when the device
    is in the __IAVF_REMOVE state.
    
    Reproduction:
    
    echo 4 > /sys/bus/pci/devices/0000:17:00.0/sriov_numvfs
    ip link set dev ens1f0 vf 0 trust on
    ip link set dev ens1f0 vf 1 trust on
    ip link set dev ens1f0 vf 2 trust on
    ip link set dev ens1f0 vf 3 trust on
    
    ip link set dev ens1f0 vf 0 mac 00:22:33:44:55:66
    ip link set dev ens1f0 vf 1 mac 00:22:33:44:55:67
    ip link set dev ens1f0 vf 2 mac 00:22:33:44:55:68
    ip link set dev ens1f0 vf 3 mac 00:22:33:44:55:69
    
    echo 0000:17:02.0 > /sys/bus/pci/devices/0000\:17\:02.0/driver/unbind
    echo 0000:17:02.1 > /sys/bus/pci/devices/0000\:17\:02.1/driver/unbind
    echo 0000:17:02.2 > /sys/bus/pci/devices/0000\:17\:02.2/driver/unbind
    echo 0000:17:02.3 > /sys/bus/pci/devices/0000\:17\:02.3/driver/unbind
    sleep 10
    echo 0000:17:02.0 > /sys/bus/pci/drivers/iavf/bind
    echo 0000:17:02.1 > /sys/bus/pci/drivers/iavf/bind
    echo 0000:17:02.2 > /sys/bus/pci/drivers/iavf/bind
    echo 0000:17:02.3 > /sys/bus/pci/drivers/iavf/bind
    
    modprobe vfio-pci
    echo 8086 154c > /sys/bus/pci/drivers/vfio-pci/new_id
    
    qemu-system-x86_64 -accel kvm -m 4096 -cpu host \
    -drive file=centos9.qcow2,if=none,id=virtio-disk0 \
    -device virtio-blk-pci,drive=virtio-disk0,bootindex=0 -smp 4 \
    -device vfio-pci,host=17:02.0 -net none \
    -device vfio-pci,host=17:02.1 -net none \
    -device vfio-pci,host=17:02.2 -net none \
    -device vfio-pci,host=17:02.3 -net none \
    -daemonize -vnc :5
    
    Current result:
    There is a probability that the mac of VF in guest is inconsistent with
    it in host
    
    Expected result:
    When passthrough NIC VF to guest, the VF in guest should always get
    the same mac as it in host.
    
    Fixes: 14756b2a ("iavf: Fix __IAVF_RESETTING state usage")
    Signed-off-by: default avatarRadoslaw Tyl <radoslawx.tyl@intel.com>
    Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    c8de44b5
iavf_main.c 146 KB