Skip to content

Commit c4e43e1

Browse files
Ganesh Goudardavem330
authored andcommitted
cxgb4: free up resources of pf 0-3
free pf 0-3 resources, commit baf5086 ("cxgb4: restructure VF mgmt code") erroneously removed the code which frees the pf 0-3 resources, causing the probe of pf 0-3 to fail in case of driver reload. Fixes: baf5086 ("cxgb4: restructure VF mgmt code") Signed-off-by: Ganesh Goudar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a8c6db1 commit c4e43e1

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4982,9 +4982,10 @@ static int cxgb4_iov_configure(struct pci_dev *pdev, int num_vfs)
49824982

49834983
pcie_fw = readl(adap->regs + PCIE_FW_A);
49844984
/* Check if cxgb4 is the MASTER and fw is initialized */
4985-
if (!(pcie_fw & PCIE_FW_INIT_F) ||
4985+
if (num_vfs &&
4986+
(!(pcie_fw & PCIE_FW_INIT_F) ||
49864987
!(pcie_fw & PCIE_FW_MASTER_VLD_F) ||
4987-
PCIE_FW_MASTER_G(pcie_fw) != CXGB4_UNIFIED_PF) {
4988+
PCIE_FW_MASTER_G(pcie_fw) != CXGB4_UNIFIED_PF)) {
49884989
dev_warn(&pdev->dev,
49894990
"cxgb4 driver needs to be MASTER to support SRIOV\n");
49904991
return -EOPNOTSUPP;
@@ -5599,24 +5600,24 @@ static void remove_one(struct pci_dev *pdev)
55995600
#if IS_ENABLED(CONFIG_IPV6)
56005601
t4_cleanup_clip_tbl(adapter);
56015602
#endif
5602-
iounmap(adapter->regs);
56035603
if (!is_t4(adapter->params.chip))
56045604
iounmap(adapter->bar2);
5605-
pci_disable_pcie_error_reporting(pdev);
5606-
if ((adapter->flags & DEV_ENABLED)) {
5607-
pci_disable_device(pdev);
5608-
adapter->flags &= ~DEV_ENABLED;
5609-
}
5610-
pci_release_regions(pdev);
5611-
kfree(adapter->mbox_log);
5612-
synchronize_rcu();
5613-
kfree(adapter);
56145605
}
56155606
#ifdef CONFIG_PCI_IOV
56165607
else {
56175608
cxgb4_iov_configure(adapter->pdev, 0);
56185609
}
56195610
#endif
5611+
iounmap(adapter->regs);
5612+
pci_disable_pcie_error_reporting(pdev);
5613+
if ((adapter->flags & DEV_ENABLED)) {
5614+
pci_disable_device(pdev);
5615+
adapter->flags &= ~DEV_ENABLED;
5616+
}
5617+
pci_release_regions(pdev);
5618+
kfree(adapter->mbox_log);
5619+
synchronize_rcu();
5620+
kfree(adapter);
56205621
}
56215622

56225623
/* "Shutdown" quiesces the device, stopping Ingress Packet and Interrupt

0 commit comments

Comments
 (0)