* [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers
@ 2020-08-17 23:12 Vinicius Costa Gomes
2020-08-17 23:12 ` [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps Vinicius Costa Gomes
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Vinicius Costa Gomes @ 2020-08-17 23:12 UTC (permalink / raw)
To: intel-wired-lan
The previous timestamping latency numbers were obtained by
interpolating the i210 numbers with the i225 crystal clock value. That
calculation was wrong.
Use the correct values from real measurements.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
drivers/net/ethernet/intel/igc/igc.h | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index 19f88f705ec3..522699b870c9 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -303,18 +303,14 @@ extern char igc_driver_name[];
#define IGC_RX_HDR_LEN IGC_RXBUFFER_256
/* Transmit and receive latency (for PTP timestamps) */
-/* FIXME: These values were estimated using the ones that i225 has as
- * basis, they seem to provide good numbers with ptp4l/phc2sys, but we
- * need to confirm them.
- */
-#define IGC_I225_TX_LATENCY_10 9542
-#define IGC_I225_TX_LATENCY_100 1024
-#define IGC_I225_TX_LATENCY_1000 178
-#define IGC_I225_TX_LATENCY_2500 64
-#define IGC_I225_RX_LATENCY_10 20662
-#define IGC_I225_RX_LATENCY_100 2213
-#define IGC_I225_RX_LATENCY_1000 448
-#define IGC_I225_RX_LATENCY_2500 160
+#define IGC_I225_TX_LATENCY_10 240
+#define IGC_I225_TX_LATENCY_100 58
+#define IGC_I225_TX_LATENCY_1000 80
+#define IGC_I225_TX_LATENCY_2500 1325
+#define IGC_I225_RX_LATENCY_10 6450
+#define IGC_I225_RX_LATENCY_100 185
+#define IGC_I225_RX_LATENCY_1000 300
+#define IGC_I225_RX_LATENCY_2500 1485
/* RX and TX descriptor control thresholds.
* PTHRESH - MAC will consider prefetch if it has fewer than this number of
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps
2020-08-17 23:12 [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Vinicius Costa Gomes
@ 2020-08-17 23:12 ` Vinicius Costa Gomes
2020-08-18 21:37 ` Jesse Brandeburg
2020-08-26 22:02 ` Brown, Aaron F
2020-08-18 21:36 ` [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Jesse Brandeburg
2020-08-26 22:02 ` Brown, Aaron F
2 siblings, 2 replies; 7+ messages in thread
From: Vinicius Costa Gomes @ 2020-08-17 23:12 UTC (permalink / raw)
To: intel-wired-lan
When timestamping a packet there's a delay between the start of the
packet and the point where the hardware actually captures the
timestamp. This difference needs to be considered if we want accurate
timestamps.
This was done on the RX side, but not on the TX side.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
drivers/net/ethernet/intel/igc/igc_ptp.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c
index f78e9acb801f..a841ac1088aa 100644
--- a/drivers/net/ethernet/intel/igc/igc_ptp.c
+++ b/drivers/net/ethernet/intel/igc/igc_ptp.c
@@ -366,6 +366,7 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
struct sk_buff *skb = adapter->ptp_tx_skb;
struct skb_shared_hwtstamps shhwtstamps;
struct igc_hw *hw = &adapter->hw;
+ int adjust = 0;
u64 regval;
if (WARN_ON_ONCE(!skb))
@@ -375,6 +376,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
regval |= (u64)rd32(IGC_TXSTMPH) << 32;
igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
+ switch (adapter->link_speed) {
+ case SPEED_10:
+ adjust = IGC_I225_TX_LATENCY_10;
+ break;
+ case SPEED_100:
+ adjust = IGC_I225_TX_LATENCY_100;
+ break;
+ case SPEED_1000:
+ adjust = IGC_I225_TX_LATENCY_1000;
+ break;
+ case SPEED_2500:
+ adjust = IGC_I225_TX_LATENCY_2500;
+ break;
+ }
+
+ shhwtstamps.hwtstamp =
+ ktime_add_ns(shhwtstamps.hwtstamp, adjust);
+
/* Clear the lock early before calling skb_tstamp_tx so that
* applications are not woken up before the lock bit is clear. We use
* a copy of the skb pointer to ensure other threads can't change it
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers
2020-08-17 23:12 [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Vinicius Costa Gomes
2020-08-17 23:12 ` [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps Vinicius Costa Gomes
@ 2020-08-18 21:36 ` Jesse Brandeburg
2020-08-18 22:52 ` Vinicius Costa Gomes
2020-08-26 22:02 ` Brown, Aaron F
2 siblings, 1 reply; 7+ messages in thread
From: Jesse Brandeburg @ 2020-08-18 21:36 UTC (permalink / raw)
To: intel-wired-lan
Vinicius Costa Gomes wrote:
> The previous timestamping latency numbers were obtained by
> interpolating the i210 numbers with the i225 crystal clock value. That
> calculation was wrong.
>
> Use the correct values from real measurements.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Is this targeted at net or net-next, and because it is a fix I
recommend you have subject
[PATCH net 1/2]
and you should include a "Fixes:" tag since this driver has been
released in previous kernels.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps
2020-08-17 23:12 ` [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps Vinicius Costa Gomes
@ 2020-08-18 21:37 ` Jesse Brandeburg
2020-08-26 22:02 ` Brown, Aaron F
1 sibling, 0 replies; 7+ messages in thread
From: Jesse Brandeburg @ 2020-08-18 21:37 UTC (permalink / raw)
To: intel-wired-lan
Vinicius Costa Gomes wrote:
> When timestamping a packet there's a delay between the start of the
> packet and the point where the hardware actually captures the
> timestamp. This difference needs to be considered if we want accurate
> timestamps.
>
> This was done on the RX side, but not on the TX side.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Please see my responses to the other patch.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers
2020-08-18 21:36 ` [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Jesse Brandeburg
@ 2020-08-18 22:52 ` Vinicius Costa Gomes
0 siblings, 0 replies; 7+ messages in thread
From: Vinicius Costa Gomes @ 2020-08-18 22:52 UTC (permalink / raw)
To: intel-wired-lan
Jesse Brandeburg <jesse.brandeburg@intel.com> writes:
> Vinicius Costa Gomes wrote:
>
>> The previous timestamping latency numbers were obtained by
>> interpolating the i210 numbers with the i225 crystal clock value. That
>> calculation was wrong.
>>
>> Use the correct values from real measurements.
>>
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
>
> Is this targeted at net or net-next, and because it is a fix I
> recommend you have subject
> [PATCH net 1/2]
Oh, sorry about that. I used the wrong 'git format-patch' line.
>
> and you should include a "Fixes:" tag since this driver has been
> released in previous kernels.
Yes. This should have been directed to 'net-queue', thanks for noticing.
Will send a v2.
Cheers,
--
Vinicius
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers
2020-08-17 23:12 [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Vinicius Costa Gomes
2020-08-17 23:12 ` [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps Vinicius Costa Gomes
2020-08-18 21:36 ` [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Jesse Brandeburg
@ 2020-08-26 22:02 ` Brown, Aaron F
2 siblings, 0 replies; 7+ messages in thread
From: Brown, Aaron F @ 2020-08-26 22:02 UTC (permalink / raw)
To: intel-wired-lan
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Vinicius Costa Gomes
> Sent: Monday, August 17, 2020 4:13 PM
> To: intel-wired-lan at lists.osuosl.org
> Cc: Guedes, Andre <andre.guedes@intel.com>
> Subject: [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers
>
> The previous timestamping latency numbers were obtained by
> interpolating the i210 numbers with the i225 crystal clock value. That
> calculation was wrong.
>
> Use the correct values from real measurements.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
> drivers/net/ethernet/intel/igc/igc.h | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps
2020-08-17 23:12 ` [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps Vinicius Costa Gomes
2020-08-18 21:37 ` Jesse Brandeburg
@ 2020-08-26 22:02 ` Brown, Aaron F
1 sibling, 0 replies; 7+ messages in thread
From: Brown, Aaron F @ 2020-08-26 22:02 UTC (permalink / raw)
To: intel-wired-lan
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Vinicius Costa Gomes
> Sent: Monday, August 17, 2020 4:13 PM
> To: intel-wired-lan at lists.osuosl.org
> Cc: Guedes, Andre <andre.guedes@intel.com>
> Subject: [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for
> timestamps
>
> When timestamping a packet there's a delay between the start of the
> packet and the point where the hardware actually captures the
> timestamp. This difference needs to be considered if we want accurate
> timestamps.
>
> This was done on the RX side, but not on the TX side.
>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
> drivers/net/ethernet/intel/igc/igc_ptp.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-08-26 22:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-17 23:12 [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Vinicius Costa Gomes
2020-08-17 23:12 ` [Intel-wired-lan] [PATCH 2/2] igc: Fix not considering the TX delay for timestamps Vinicius Costa Gomes
2020-08-18 21:37 ` Jesse Brandeburg
2020-08-26 22:02 ` Brown, Aaron F
2020-08-18 21:36 ` [Intel-wired-lan] [PATCH 1/2] igc: Fix wrong timestamp latency numbers Jesse Brandeburg
2020-08-18 22:52 ` Vinicius Costa Gomes
2020-08-26 22:02 ` Brown, Aaron F
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).