[PATCH v2 074/148] net/ice/base: improve read retry value calculation

Anatoly Burakov anatoly.burakov at intel.com
Wed Jun 12 17:01:08 CEST 2024


From: Ian Stokes <ian.stokes at intel.com>

Previous implementation of PHY timestamp retry value was set to a static value
that had no meaning. Change it to calculate it based on a set of meaningfully
named macros, as well as adjust data type to avoid overflows.

Signed-off-by: Bartosz Staszewski <bartoszx.staszewski at intel.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
---
 drivers/net/ice/base/ice_ptp_hw.c | 2 +-
 drivers/net/ice/base/ice_ptp_hw.h | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c
index ddcadf603c..cc840a8a4b 100644
--- a/drivers/net/ice/base/ice_ptp_hw.c
+++ b/drivers/net/ice/base/ice_ptp_hw.c
@@ -4583,7 +4583,7 @@ static int ice_write_phy_reg_e810(struct ice_hw *hw, u32 addr, u32 val)
 static int
 ice_read_phy_tstamp_ll_e810(struct ice_hw *hw, u8 idx, u8 *hi, u32 *lo)
 {
-	u8 i;
+	unsigned int i;
 
 	/* Write TS index to read to the PF register so the FW can read it */
 	wr32(hw, PF_SB_ATQBAL, TS_LL_READ_TS_IDX(idx));
diff --git a/drivers/net/ice/base/ice_ptp_hw.h b/drivers/net/ice/base/ice_ptp_hw.h
index 50716e7b25..8a1f5c6163 100644
--- a/drivers/net/ice/base/ice_ptp_hw.h
+++ b/drivers/net/ice/base/ice_ptp_hw.h
@@ -521,7 +521,11 @@ int ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #define BYTES_PER_IDX_ADDR_L		4
 
 /* Tx timestamp low latency read definitions */
-#define TS_LL_READ_RETRIES		200
+#define TS_LL_MAX_TIME_READ_PER_PORT	80
+#define TS_LL_MAX_PORT			8
+#define TS_LL_DELTA_TIME		360
+#define TS_LL_READ_RETRIES		(TS_LL_MAX_TIME_READ_PER_PORT * \
+					 TS_LL_MAX_PORT) + TS_LL_DELTA_TIME
 #define TS_LL_READ_TS_INTR		BIT(30)
 #define TS_LL_READ_TS			BIT(31)
 #define TS_LL_READ_TS_IDX_S		24
-- 
2.43.0



More information about the dev mailing list