Skip to contentSkip to conversation

octeontx2: Fix PTP bugs

PATCH Applied Subbaraya Sundeep 2 participants 4 messages Jan 7, 2022

Subsystems (4)
lore
Share & tools
lore

Subbaraya Sundeep

author maintainer
#0 lore raw

cover 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.

Thanks,
Sundeep

Rakesh Babu Saladi (1):
octeontx2-nicvf: Free VF PTP resources.

Subbaraya Sundeep (1):
octeontx2-af: Increment ptp refcount before use

 drivers/net/ethernet/marvell/octeontx2/af/ptp.c      | 2 ++
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/2 octeontx2-af: Increment ptp refcount before use

Before using the ptp pci device by AF driver increment the reference count of it.

Fixes a8b90c9d26d6 ("octeontx2-af: Add PTP device id for CN10K and 95O silcons")
---
 drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/ptp.c +2 -0
index d6321de..e682b7b 100644
@@ -60,6 +60,8 @@ struct ptp *ptp_get(void)
 	/* Check driver is bound to PTP block */
 	if (!ptp)
 		ptp = ERR_PTR(-EPROBE_DEFER);
+	else
+		pci_dev_get(ptp->pdev);
 
 	return ptp;
 }
Signature · 1 line
2.7.4
author maintainer
#2 lore raw

PATCH 2/2 octeontx2-nicvf: Free VF PTP resources.

In reply to Subbaraya Sundeep

From: Rakesh Babu Saladi <[email protected]>

When a VF is removed respective PTP resources are not being freed currently. This patch fixes it.

Fixes 43510ef4ddad ("octeontx2-nicvf: Add PTP hardware clock support to NIX VF")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +4 -1
index 78944ad..d75f3a7 100644
@@ -684,7 +684,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	err = register_netdev(netdev);
 	if (err) {
 		dev_err(dev, "Failed to register netdevice\n");
-		goto err_detach_rsrc;
+		goto err_ptp_destroy;
 	}
 
 	err = otx2_wq_init(vf);
@@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 err_unreg_netdev:
 	unregister_netdev(netdev);
+err_ptp_destroy:
+	otx2_ptp_destroy(vf);
 err_detach_rsrc:
 	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
 		qmem_free(vf->dev, vf->dync_lmt);
@@ -742,6 +744,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
 	unregister_netdev(netdev);
 	if (vf->otx2_wq)
 		destroy_workqueue(vf->otx2_wq);
+	otx2_ptp_destroy(vf);
 	otx2vf_disable_mbox_intr(vf);
 	otx2_detach_resources(&vf->mbox);
 	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
Signature · 1 line
2.7.4
#3 lore raw
In reply to Subbaraya Sundeep
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Quoted 9 lines · On Fri, 7 Jan 2022 12:00:28 +0530 you wrote:

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.

[...]

Here is the summary with links:
- [net,1/2] octeontx2-af: Increment ptp refcount before use

    https://git.kernel.org/netdev/net/c/93440f4888cf
  - [net,2/2] octeontx2-nicvf: Free VF PTP resources.
    https://git.kernel.org/netdev/net/c/eabd0f88b0d2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html