]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: enetc: avoid VF->PF mailbox timeout during SR-IOV teardown
authorWei Fang <wei.fang@nxp.com>
Wed, 20 May 2026 06:44:21 +0000 (14:44 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 21 May 2026 15:49:00 +0000 (08:49 -0700)
During SR-IOV teardown, enetc_msg_psi_free() disables the MR interrupt
before pci_disable_sriov() removes the VFs. If a VF sends a mailbox
message during this window, the PF cannot receive it, causing the VF to
timeout waiting for a reply.

Since the timeout occurs during SR-IOV teardown when the VF is about to
be removed anyway, it has no functional impact on operation. However,
more messages will be added in the future, some visible error logs may
confuse users. So fix it by calling pci_disable_sriov() first to remove
all VFs, then safely clean up the mailbox resources. This eliminates the
race window where VFs could send messages to an unresponsive PF.

Fixes: beb74ac878c8 ("enetc: Add vf to pf messaging support")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20260520064421.91569-10-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc_pf.c

index 8e11a023d516b67f1a5513f49de4a5f8dd145940..3206b3daa1a0a580f3b996fe325448d17f62047b 100644 (file)
@@ -563,9 +563,9 @@ static int enetc_sriov_configure(struct pci_dev *pdev, int num_vfs)
        int err;
 
        if (!num_vfs) {
+               pci_disable_sriov(pdev);
                enetc_msg_psi_free(pf);
                pf->num_vfs = 0;
-               pci_disable_sriov(pdev);
        } else {
                pf->num_vfs = num_vfs;