Commit b69c5b58 authored by David S. Miller's avatar David S. Miller

Merge branch 'octeontx2-ptp-bugs'

Subbaraya Sundeep says:

====================
octeontx2: Fix PTP bugs

This patchset addresses two problems found when using
ptp.
Patch 1 - Increases the refcount of ptp device before use
which was missing and it lead to refcount increment after use
bug when module is loaded and unloaded couple of times.
Patch 2 - PTP resources allocated by VF are not being freed
during VF teardown. This patch fixes that.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fff63521 eabd0f88
...@@ -60,6 +60,8 @@ struct ptp *ptp_get(void) ...@@ -60,6 +60,8 @@ struct ptp *ptp_get(void)
/* Check driver is bound to PTP block */ /* Check driver is bound to PTP block */
if (!ptp) if (!ptp)
ptp = ERR_PTR(-EPROBE_DEFER); ptp = ERR_PTR(-EPROBE_DEFER);
else
pci_dev_get(ptp->pdev);
return ptp; return ptp;
} }
......
...@@ -684,7 +684,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -684,7 +684,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err = register_netdev(netdev); err = register_netdev(netdev);
if (err) { if (err) {
dev_err(dev, "Failed to register netdevice\n"); dev_err(dev, "Failed to register netdevice\n");
goto err_detach_rsrc; goto err_ptp_destroy;
} }
err = otx2_wq_init(vf); err = otx2_wq_init(vf);
...@@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_unreg_netdev: err_unreg_netdev:
unregister_netdev(netdev); unregister_netdev(netdev);
err_ptp_destroy:
otx2_ptp_destroy(vf);
err_detach_rsrc: err_detach_rsrc:
if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
qmem_free(vf->dev, vf->dync_lmt); qmem_free(vf->dev, vf->dync_lmt);
...@@ -742,6 +744,7 @@ static void otx2vf_remove(struct pci_dev *pdev) ...@@ -742,6 +744,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
unregister_netdev(netdev); unregister_netdev(netdev);
if (vf->otx2_wq) if (vf->otx2_wq)
destroy_workqueue(vf->otx2_wq); destroy_workqueue(vf->otx2_wq);
otx2_ptp_destroy(vf);
otx2vf_disable_mbox_intr(vf); otx2vf_disable_mbox_intr(vf);
otx2_detach_resources(&vf->mbox); otx2_detach_resources(&vf->mbox);
if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment