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

Message ID 9e6d6ac32d98d3371f474662f6d594611d38dd51.1718204528.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Bruce Richardson
Headers
Series Update net/ice base driver to latest upstream snapshot |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Burakov, Anatoly June 12, 2024, 3:01 p.m. UTC
From: Ian Stokes <ian.stokes@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@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@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(-)
  

Patch

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