News

Linux 7.4-rc3 fixes a dual-port Ethernet timestamp mix-up

The release candidate includes a fix for TI’s CPTS driver after testing on AM62x found that PTPv1 messages on one port could pick up a transmit timestamp from the other.
An Intel X540-T2 network adapter with two Ethernet ports.

A dual-port Ethernet adapter, shown for illustration. The Linux fix concerns a Texas Instruments AM62x system.

Image: Dmitry Nosachev / Wikimedia Commons. (unmodified) · CC BY-SA 4.0

Linux 7.4-rc3 fixes a timestamp error in Texas Instruments’ CPTS Ethernet driver. Patch author Jesper L. Nielsen found that on an AM62x system sending Precision Time Protocol version 1 (PTPv1) traffic on both Ethernet ports, the driver could attach a valid hardware timestamp to a packet sent on the other port.

When the sequence numbers on the two ports lined up, a timestamp still queued for a Follow_Up frame on one port could be picked up by a Sync frame on the other. The driver’s PTPv1 workaround matched on sequence number alone. The patch corrects how the driver interprets the message type while keeping the port and event type in the comparison.

In the two-step exchange Nielsen describes, the Follow_Up message carries the precise transmit time of the preceding Sync message. Attach a timestamp from an earlier frame on the other port and the receiving clock can be told the Sync left up to one full Sync interval too early. Nielsen cites a redundant Dante audio network as an example of how both ports can be active with sequence numbers running together.

Nielsen tested the fix on AM62x hardware running TI’s 6.12 kernel branch with an earlier port-number change backported. When PTP started together on both ports, the setup sent incorrect Sync timestamps on 10 of 10 boots before the fix and none in 29 boots with it applied. Torvalds’s 7.4-rc3 change list records the fix in upstream Linux; the hardware results came from the separate TI branch.

Sources: Linus Torvalds’s release announcement and change list; Jesper L. Nielsen’s patch and test notes.

Continue reading