Bug 2237149 - LinuxPTP 4.0 incompatibility with Raspberry Pi CM4 NIC
Summary: LinuxPTP 4.0 incompatibility with Raspberry Pi CM4 NIC
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: linuxptp
Version: 38
Hardware: aarch64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-09-04 02:55 UTC by James Clark
Modified: 2024-01-02 08:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-04 10:33:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description James Clark 2023-09-04 02:55:58 UTC
Description of problem:

LinuxPTP sets the minor version of PTP packets to a non-zero value. Unfortunately, the PTP hardware included in the Raspberry Pi CM4 is unable to timestamp packets unless the minor version is unusable. The maintainer has adopted the policy of not working round broken hardware, and accordingly has declined to incorporate a patch that fixes the problem. The Raspberry Pi CM4 currently provides the cheapest way to implement a PTP grandmaster. But this is no longer possible with LinuxPTP 4.0 without a patch.

Apart from this problem, Fedora 38 is quite useable on the CM4. I have written a guide here https://github.com/jclark/rpi-cm4-ptp-guide/blob/main/fedora.md

There's more discussion here: https://github.com/jclark/rpi-cm4-ptp-guide/issues/23

There's discussion on the LinuxPTP mailing list here https://www.mail-archive.com/linuxptp-users@lists.sourceforge.net/msg03316.html

and a possible patch here that makes the minor version configurable

https://www.mail-archive.com/linuxptp-devel@lists.sourceforge.net/msg06374.html

My question is whether Fedora would be open to including a patch. If so, I am happy to work on testing it.

Version-Release number of selected component (if applicable):

LinuxPTP 4.0
How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Miroslav Lichvar 2023-09-04 10:33:56 UTC
Thanks for writing that guide. You linked to the Fedora upstreaming guidelines:
https://docs.fedoraproject.org/en-US/package-maintainers/Staying_Close_to_Upstream_Projects/

There is a strong argument made to avoid Fedora-specific patches. That would be the patch adding a new option to configure older PTP version, which was rejected upstream. A Fedora-specific configuration option would lead to confusion and unhappy upstream.

I think the only option here is to convince the upstream to make an exception in their policy of supporting broken hardware, e.g. if the CM4 is shown to be a popular choice for PTP.

Comment 2 James Clark 2023-12-24 01:15:14 UTC
@mlichvar I've had an idea for solving this that doesn't require any upstream change. As I understand it, the problem is that the hardware will only timestamp an outgoing packet if the minor version is 0. If so, I think it should be possible to work around this by using tc with an eBPF filter that modifies the packet to make the minor version 0, along the lines of https://taoshu.in/unix/modify-udp-packet-using-ebpf.html. Has this got a chance of working?

Comment 3 James Clark 2023-12-28 07:05:05 UTC
I've implemented this idea and in my limited testing it appears to work.

https://github.com/jclark/bpf-ptpver20

Comment 4 Miroslav Lichvar 2024-01-02 08:22:02 UTC
That is an interesting workaround.

It seems it won't be needed after all. The upstream changed their mind and accepted a patch adding new option ptp_minor_version in linuxptp-4.2 to make it configurable. I'll prepare an update for Fedora 39.


Note You need to log in before you can comment on or make changes to this bug.