Skip to contentSkip to conversation

bnxt_en: reset PHC frequency in free-running mode

PATCH Applied Vadim Fedorenko 3 participants 3 messages Mar 10, 2023 – Mar 13, 2023

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

PATCH v4 1/1 bnxt_en: reset PHC frequency in free-running mode

When using a PHC in shared between multiple hosts, the previous frequency value may not be reset and could lead to host being unable to compensate the offset with timecounter adjustments. To avoid such state reset the hardware frequency of PHC to zero on init. Some refactoring is needed to make code readable.

Fixes 85036aee1938 ("bnxt_en: Add a non-real time mode to access NIC clock")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     |  6 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt.h     |  2 +
 drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 56 ++++++++++---------
 3 files changed, 35 insertions(+), 29 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -4
index 808236dc898b..e2e2c986c82b 100644
@@ -6990,11 +6990,9 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 		if (flags & FUNC_QCFG_RESP_FLAGS_FW_DCBX_AGENT_ENABLED)
 			bp->fw_cap |= BNXT_FW_CAP_DCBX_AGENT;
 	}
-	if (BNXT_PF(bp) && (flags & FUNC_QCFG_RESP_FLAGS_MULTI_HOST)) {
+	if (BNXT_PF(bp) && (flags & FUNC_QCFG_RESP_FLAGS_MULTI_HOST))
 		bp->flags |= BNXT_FLAG_MULTI_HOST;
-		if (bp->fw_cap & BNXT_FW_CAP_PTP_RTC)
-			bp->fw_cap &= ~BNXT_FW_CAP_PTP_RTC;
-	}
+
 	if (flags & FUNC_QCFG_RESP_FLAGS_RING_MONITOR_ENABLED)
 		bp->fw_cap |= BNXT_FW_CAP_RING_MONITOR;
 
drivers/net/ethernet/broadcom/bnxt/bnxt.h +2 -0
index dcb09fbe4007..c0628ac1b798 100644
@@ -2000,6 +2000,8 @@ struct bnxt {
 	u32			fw_dbg_cap;
 
 #define BNXT_NEW_RM(bp)		((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
+#define BNXT_PTP_USE_RTC(bp)	(!BNXT_MH(bp) && \
+				 ((bp)->fw_cap & BNXT_FW_CAP_PTP_RTC))
 	u32			hwrm_spec_code;
 	u16			hwrm_cmd_seq;
 	u16                     hwrm_cmd_kong_seq;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +31 -25

99 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Reviewed-by on v4 1/1
#1 lore raw
Quoted 10 lines · Vadim Fedorenko

When using a PHC in shared between multiple hosts, the previous frequency value may not be reset and could lead to host being unable to compensate the offset with timecounter adjustments. To avoid such state reset the hardware frequency of PHC to zero on init. Some refactoring is needed to make code readable.

Fixes 85036aee1938 ("bnxt_en: Add a non-real time mode to access NIC clock")

---

Thank you.

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

Hello:

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

Quoted 10 lines · On Fri, 10 Mar 2023 07:13:56 -0800 you wrote:

When using a PHC in shared between multiple hosts, the previous frequency value may not be reset and could lead to host being unable to compensate the offset with timecounter adjustments. To avoid such state reset the hardware frequency of PHC to zero on init. Some refactoring is needed to make code readable.

Fixes 85036aee1938 ("bnxt_en: Add a non-real time mode to access NIC clock")

[...]

Here is the summary with links:
- [net,v4] bnxt_en: reset PHC frequency in free-running mode

    https://git.kernel.org/netdev/net/c/131db4991622

You are awesome, thank you!

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