lkml.org 
[lkml]   [2023]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH net-next 6/7] net: stmmac: Fix comment about default addend calculation
The comment neglects that freq_div_ratio is the ratio between
the subsecond increment frequency and the clk_ptp_rate frequency.

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index dfead0df6163..64185753865f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -853,10 +853,12 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags)
/* Store sub second increment for later use */
priv->sub_second_inc = sub_second_inc;

- /* calculate default addend value:
- * formula is :
- * addend = (2^32)/freq_div_ratio;
- * where, freq_div_ratio = 1e9ns/sub_second_inc
+ /* Calculate default addend so the accumulator overflows (2^32) in
+ * sub_second_inc (ns). The addend is added to the accumulator
+ * every clk_ptp cycle.
+ *
+ * addend = (2^32) / freq_div_ratio
+ * where, freq_div_ratio = (1e9ns / sub_second_inc) / clk_ptp_rate
*/
temp = div_u64(NSEC_PER_SEC, sub_second_inc);
temp = temp << 32;
--
2.41.0

\
 
 \ /
  Last update: 2023-08-24 20:36    [W:0.068 / U:1.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site