netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bnxt_en: Incorrect tx timestamp report
@ 2025-03-20 14:35 Kamil Zaripov
  2025-03-20 14:48 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Kamil Zaripov @ 2025-03-20 14:35 UTC (permalink / raw)
  To: netdev

Hi all,

I've encountered a bug in the bnxt_en driver and I am unsure about the correct approach to fix it. Every 2^48 nanoseconds (or roughly 78.19 hours) there is a probability that the hardware timestamp for a sent packet may deviate by either 2^48 nanoseconds less or 2^47 nanoseconds more compared to the actual time.

This issue likely occurs within the bnxt_async_event_process function when handling the ASYNC_EVENT_CMPL_EVENT_ID_PHC_UPDATE event. It appears that the payload of this event contains bits 48–63 of the PHC timer counter. During event handling, this function reads bits 0–47 of the same counter to combine them and subsequently updates the cycle_last field within the struct timecounter. The relevant code can be found here:
https://elixir.bootlin.com/linux/v6.13.7/source/drivers/net/ethernet/broadcom/bnxt/bnxt.c#L2829-L2833

The issue arises if bits 48–63 of the PHC counter increment by 1 between sending the ASYNC_EVENT_CMPL_EVENT_ID_PHC_UPDATE event and its actual handling by the driver. In such a case, cycle_last becomes approximately 2^48 nanoseconds behind the real-time value.

A possibly related issue involves the BCM57502 network card, which seemingly possesses only a single PHC device. However, the bnxt_en driver creates four PHC Linux devices when operating in quad-port mode. Consequently, clock synchronization daemons like phc2sys attempt to independently synchronize the system clock to each of these four PHC clocks. This scenario can lead to unstable synchronization and might also trigger additional ASYNC_EVENT_CMPL_EVENT_ID_PHC_UPDATE events.

Given these issues, I have two questions:

1. Would it be beneficial to modify the bnxt_en driver to create only a single PHC Linux device for network cards that physically have only one PHC?

2. Is there a method available to read the complete 64-bit PHC counter to mitigate the observed problem of 2^48-nanosecond time jumps?

Best regards,
Zaripov Kamil


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-04-01 20:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-20 14:35 bnxt_en: Incorrect tx timestamp report Kamil Zaripov
2025-03-20 14:48 ` Andrew Lunn
     [not found]   ` <CAGtf3ibFAidzpFKm1o5zmZF3Neu8MgdXp_n_Wt+mv8M9YZhhug@mail.gmail.com>
2025-03-20 15:14     ` Kamil Zaripov
2025-03-20 16:21   ` Vadim Fedorenko
2025-03-20 15:56 ` Pavan Chebbi
2025-03-20 16:21   ` Kamil Zaripov
2025-03-20 16:26   ` Vadim Fedorenko
2025-03-20 17:11 ` Jacob Keller
2025-03-21 15:17   ` Kamil Zaripov
2025-03-21 17:33     ` Michael Chan
2025-03-24 15:04       ` Pavan Chebbi
2025-03-25 10:13         ` Kamil Zaripov
2025-03-25 10:41           ` Vadim Fedorenko
2025-03-25 12:24             ` Pavan Chebbi
2025-03-26 13:50             ` Kamil Zaripov
2025-03-26 20:31               ` Jacob Keller
2025-03-27 13:16               ` Pavan Chebbi
2025-04-01 20:17                 ` Keller, Jacob E

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).