Skip to contentSkip to conversation

bnxt_en: enable PTM function

PATCH Applied Vadim Fedorenko 4 participants 10 messages Aug 6 – Aug 12

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bnxt_en: enable PTM function

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

Fixes c470195b989f ("bnxt_en: Add PTP .getcrosststamp() interface to get device/host times")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -0
index 25099077fe4f..8a9c7646b53f 100644
@@ -14978,6 +14978,7 @@ static void bnxt_unmap_bars(struct bnxt *bp, struct pci_dev *pdev)
 
 static void bnxt_cleanup_pci(struct bnxt *bp)
 {
+	pci_disable_ptm(bp->pdev);
 	bnxt_unmap_bars(bp, bp->pdev);
 	pci_release_regions(bp->pdev);
 	if (pci_is_enabled(bp->pdev))
@@ -15546,6 +15547,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
 		goto init_err_release;
 	}
 
+	pci_enable_ptm(pdev);
+
 	INIT_WORK(&bp->sp_task, bnxt_sp_task);
 	INIT_DELAYED_WORK(&bp->fw_reset_task, bnxt_fw_reset_task);
 
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 5 lines · Vadim Fedorenko

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

We were actually discussing this internally just a few weeks ago. I think the FW always enables it and that's why pci_enable_ptm() is not strictly required. I'll let Pavan comment on this further. Thanks.

#2 lore raw
Quoted 11 lines · Michael Chan
Quoted 5 lines · Vadim Fedorenko

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

We were actually discussing this internally just a few weeks ago. I think the FW always enables it and that's why pci_enable_ptm() is not strictly required. I'll let Pavan comment on this further. Thanks.

In my test even though firmware was acting as requestor, pcie_ptm_enabled() returns false and disables setup of getcrosststamp callback. This happens because kernel doesn't know that PTM is enabled.

maintainer
#3 lore raw
Quoted 10 lines · Vadim Fedorenko
Quoted 8 lines · Michael Chan
Quoted 5 lines · Vadim Fedorenko

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

Quoted 7 lines
Quoted 3 lines

We were actually discussing this internally just a few weeks ago. I think the FW always enables it and that's why pci_enable_ptm() is not strictly required. I'll let Pavan comment on this further. Thanks.

In my test even though firmware was acting as requestor, pcie_ptm_enabled() returns false and disables setup of getcrosststamp callback. This happens because kernel doesn't know that PTM is enabled.

I think the right thing to do would be to first check the capability from FW (which actually decides whether we can support PTM on the installed RC/platform) and then enable it in the kernel. This is what we internally decided to do. Can you wait for us to complete that work and send the patch?

#4 lore raw
Quoted 20 lines · Pavan Chebbi
Quoted 10 lines · Vadim Fedorenko
Quoted 8 lines · Michael Chan
Quoted 5 lines · Vadim Fedorenko

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

Quoted 7 lines
Quoted 3 lines

We were actually discussing this internally just a few weeks ago. I think the FW always enables it and that's why pci_enable_ptm() is not strictly required. I'll let Pavan comment on this further. Thanks.

In my test even though firmware was acting as requestor, pcie_ptm_enabled() returns false and disables setup of getcrosststamp callback. This happens because kernel doesn't know that PTM is enabled.

Quoted 5 lines

I think the right thing to do would be to first check the capability from FW (which actually decides whether we can support PTM on the installed RC/platform) and then enable it in the kernel. This is what we internally decided to do. Can you wait for us to complete that work and send the patch?

Could you please be a bit more specific on how FW decides? Does it remove PTM capability in case it's not possible?

As you can see from the code of pci_enable_ptm(), sometimes parent device needs PTM enabled as well before starting TLVs, will your FW be aware of this?

What I'm trying to say is that it looks like you try to reinvent what has already been implemented. pcie_ptm_enabled() is harmless in case the platform cannot support it, and you are gating getcrosststamp() by FW capabilities already - why do you need another check?

maintainer
#5 lore raw
Quoted 32 lines · Vadim Fedorenko
Quoted 20 lines · Pavan Chebbi
Quoted 10 lines · Vadim Fedorenko
Quoted 8 lines · Michael Chan
Quoted 5 lines · Vadim Fedorenko

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

Quoted 7 lines
Quoted 3 lines

We were actually discussing this internally just a few weeks ago. I think the FW always enables it and that's why pci_enable_ptm() is not strictly required. I'll let Pavan comment on this further. Thanks.

In my test even though firmware was acting as requestor, pcie_ptm_enabled() returns false and disables setup of getcrosststamp callback. This happens because kernel doesn't know that PTM is enabled.

Quoted 5 lines

I think the right thing to do would be to first check the capability from FW (which actually decides whether we can support PTM on the installed RC/platform) and then enable it in the kernel. This is what we internally decided to do. Can you wait for us to complete that work and send the patch?

Could you please be a bit more specific on how FW decides? Does it remove PTM capability in case it's not possible?

Quoted 8 lines

As you can see from the code of pci_enable_ptm(), sometimes parent device needs PTM enabled as well before starting TLVs, will your FW be aware of this?

What I'm trying to say is that it looks like you try to reinvent what has already been implemented. pcie_ptm_enabled() is harmless in case the platform cannot support it, and you are gating getcrosststamp() by FW capabilities already - why do you need another check?

Ok I understand you now. Maybe it is fine to have pcie_ptm_enabled()/disabled() called for this version of the driver. Since FW currently always enables it, and these calls are harmless and turn off .getcrosststamp on platforms that don't support PTM, both FW and driver/kernel end up working in sync.
Only thing I would argue is should this be done in bnxt_ptp_init() and clear()? Since as much as PTM is a PCIe feature, the cross timestamps are tied with PTP.

#6 lore raw
Quoted 43 lines · Pavan Chebbi
Quoted 32 lines · Vadim Fedorenko
Quoted 20 lines · Pavan Chebbi
Quoted 10 lines · Vadim Fedorenko
Quoted 8 lines · Michael Chan
Quoted 5 lines · Vadim Fedorenko

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

Quoted 7 lines
Quoted 3 lines

We were actually discussing this internally just a few weeks ago. I think the FW always enables it and that's why pci_enable_ptm() is not strictly required. I'll let Pavan comment on this further. Thanks.

In my test even though firmware was acting as requestor, pcie_ptm_enabled() returns false and disables setup of getcrosststamp callback. This happens because kernel doesn't know that PTM is enabled.

Quoted 5 lines

I think the right thing to do would be to first check the capability from FW (which actually decides whether we can support PTM on the installed RC/platform) and then enable it in the kernel. This is what we internally decided to do. Can you wait for us to complete that work and send the patch?

Could you please be a bit more specific on how FW decides? Does it remove PTM capability in case it's not possible?

Quoted 8 lines

As you can see from the code of pci_enable_ptm(), sometimes parent device needs PTM enabled as well before starting TLVs, will your FW be aware of this?

What I'm trying to say is that it looks like you try to reinvent what has already been implemented. pcie_ptm_enabled() is harmless in case the platform cannot support it, and you are gating getcrosststamp() by FW capabilities already - why do you need another check?

Quoted 8 lines

Ok I understand you now. Maybe it is fine to have pcie_ptm_enabled()/disabled() called for this version of the driver. Since FW currently always enables it, and these calls are harmless and turn off .getcrosststamp on platforms that don't support PTM, both FW and driver/kernel end up working in sync.
Only thing I would argue is should this be done in bnxt_ptp_init() and clear()? Since as much as PTM is a PCIe feature, the cross timestamps are tied with PTP.

It makes sense to have PCIe things tied together, because PTM is PCIe feature. Cross timestamps configuration are already in ptp area of the driver, so no need to change anything around it

maintainer Reviewed-by
#7 lore raw
Quoted 9 lines
Quoted 8 lines

Ok I understand you now. Maybe it is fine to have pcie_ptm_enabled()/disabled() called for this version of the driver. Since FW currently always enables it, and these calls are harmless and turn off .getcrosststamp on platforms that don't support PTM, both FW and driver/kernel end up working in sync.
Only thing I would argue is should this be done in bnxt_ptp_init() and clear()? Since as much as PTM is a PCIe feature, the cross timestamps are tied with PTP.

Quoted 3 lines

It makes sense to have PCIe things tied together, because PTM is PCIe feature. Cross timestamps configuration are already in ptp area of the driver, so no need to change anything around it

OK. Fine with me.

Thanks

#8 lore raw
Quoted 9 lines · Pavan Chebbi
Quoted 9 lines
Quoted 8 lines

Ok I understand you now. Maybe it is fine to have pcie_ptm_enabled()/disabled() called for this version of the driver. Since FW currently always enables it, and these calls are harmless and turn off .getcrosststamp on platforms that don't support PTM, both FW and driver/kernel end up working in sync.
Only thing I would argue is should this be done in bnxt_ptp_init() and clear()? Since as much as PTM is a PCIe feature, the cross timestamps are tied with PTP.

Quoted 7 lines
Quoted 3 lines

It makes sense to have PCIe things tied together, because PTM is PCIe feature. Cross timestamps configuration are already in ptp area of the driver, so no need to change anything around it

OK. Fine with me.

Thanks

Jakub, it looks like we have to drop fixes tag and apply it to net-next as it has never worked on upstream kernel.

Sashiko's comments are not really valuable - underflow of ptm_enabled_cnt may happen only right before the device structure is freed, so it actually doesn't matter, all other drivers do not care about ptm counter as well on destroy path. And validating result of pci_enable_ptm() also makes no sense because we don't care about the result, only thing we can do is to put debug message, but that can also be figured out in run-time.

#9 lore raw
In reply to Vadim Fedorenko
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 6 Aug 2026 20:18:49 +0000 you wrote:

The patch mentioned in Fixes missed one main point of implementing proper PTM support. To make it fully operational it has to be explicitly enabled. Add missing call in probe callback and disable it in teardown callback.

Fixes c470195b989f ("bnxt_en: Add PTP .getcrosststamp() interface to get device/host times")

[...]

Here is the summary with links:
- [net] bnxt_en: enable PTM function

    https://git.kernel.org/netdev/net-next/c/5838193edcca

You are awesome, thank you!

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