Message ID | 20230807125940.985494-1-radoslawx.tyl@intel.com |
---|---|
State | Accepted |
Delegated to: | Anthony Nguyen |
Headers | show |
Series | [iwl-net] iavf: do no process adminq tasks when __IAVF_IN_REMOVE_TASK is set | expand |
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Radoslaw Tyl > Sent: Monday, August 7, 2023 3:00 PM > To: intel-wired-lan@lists.osuosl.org > Cc: Tyl, RadoslawX <radoslawx.tyl@intel.com> > Subject: [Intel-wired-lan] [PATCH iwl-net] iavf: do no process adminq tasks > when __IAVF_IN_REMOVE_TASK is set > > 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: 14756b2ae265 ("iavf: Fix __IAVF_RESETTING state usage") > Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com> > --- > drivers/net/ethernet/intel/iavf/iavf_main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c > b/drivers/net/ethernet/intel/iavf/iavf_main.c > index f329f81c793d..7ebbf2a4c487 100644 > --- a/drivers/net/ethernet/intel/iavf/iavf_main.c > +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c > @@ -1421,7 +1421,8 @@ void iavf_down(struct iavf_adapter *adapter) Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index f329f81c793d..7ebbf2a4c487 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -1421,7 +1421,8 @@ void iavf_down(struct iavf_adapter *adapter) iavf_clear_fdir_filters(adapter); iavf_clear_adv_rss_conf(adapter); - if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)) { + if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) && + !(test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section))) { /* cancel any current operation */ adapter->current_op = VIRTCHNL_OP_UNKNOWN; /* Schedule operations to close down the HW. Don't wait
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: 14756b2ae265 ("iavf: Fix __IAVF_RESETTING state usage") Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com> --- drivers/net/ethernet/intel/iavf/iavf_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)