Skip to contentSkip to conversation

ice/ptp: fix crosstimestamp reporting

PATCH Superseded Anton Nadezhdin 2 participants 3 messages May 15, 2025 – May 19, 2025

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ice/ptp: fix crosstimestamp reporting

Set use_nsecs=true as timestamp is reported in ns. Lack of this result in smaller timestamp error window which cause error during phc2sys execution on E825 NICs:
phc2sys[1768.256]: ioctl PTP_SYS_OFFSET_PRECISE: Invalid argument

Before commit "Provide infrastructure for converting to/from a base clock" the parameter use_nsec was not required. "Remove convert_art_to_tsc()" rework shall already contain use_nsecs=true.

Testing hints (ethX is PF netdev):
phc2sys -s ethX -c CLOCK_REALTIME -O 37 -m
phc2sys[1769.256]: CLOCK_REALTIME phc offset -5 s0 freq -0 delay 0

Fixes d4bea547ebb57 ("ice/ptp: Remove convert_art_to_tsc()")

Fixes" 6b2e29977518e ("timekeeping: Provide infrastructure for converting to/from a base clock")

---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/ice/ice_ptp.c +1 -0
index 1fd1ae03eb90..11ed48a62b53 100644
@@ -2307,6 +2307,7 @@ static int ice_capture_crosststamp(ktime_t *device,
 	ts = ((u64)ts_hi << 32) | ts_lo;
 	system->cycles = ts;
 	system->cs_id = CSID_X86_ART;
+	system->use_nsecs = true;
 
 	/* Read Device source clock time */
 	ts_lo = rd32(hw, cfg->dev_time_l[tmr_idx]);

base-commit: 7e5af365e38059ed585917623c1ba3a6c04a8c10

Signature · 1 line
2.34.1
reviewer
#1 lore raw
Quoted 6 lines · Anton Nadezhdin

Set use_nsecs=true as timestamp is reported in ns. Lack of this result in smaller timestamp error window which cause error during phc2sys execution on E825 NICs:
phc2sys[1768.256]: ioctl PTP_SYS_OFFSET_PRECISE: Invalid argument

Before commit "Provide infrastructure for converting to/from a base clock"

Hi Anton,

Thanks for your patch.

I have some feedback on the form of the commit message, I hope it is useful.

The correct syntax for fully citing a commit is:
commit 6b2e29977518 ("timekeeping: Provide infrastructure for converting to/from a base clock")

Quoted 2 lines

the parameter use_nsec was not required. "Remove convert_art_to_tsc()" rework shall already contain use_nsecs=true.

I think it would be clearer to express this something along these lines.

This problem was introduced in commit d4bea547ebb57 ("ice/ptp: Remove convert_art_to_tsc()") which omitted setting use_nsecs to true when converting the ice driver to use convert_base_to_cs().

Or if there is only one Fixes tag, as I propose below, and there is no reference to any other commit in the commit message, you could shorten it a bit to.

This problem was introduced in the cited commit which omitted setting use_nsecs to true when converting the ice driver to use convert_base_to_cs().

OTOH, if you think it is useful you could add something like this. But IMHO it isn't adding much value and I'd leave it out based on less being more.

convert_base_to_cs() was added by commit 6b2e29977518 ("timekeeping:
Provide infrastructure for converting to/from a base clock").

Quoted 6 lines

Testing hints (ethX is PF netdev):
phc2sys -s ethX -c CLOCK_REALTIME -O 37 -m
phc2sys[1769.256]: CLOCK_REALTIME phc offset -5 s0 freq -0 delay 0

Fixes d4bea547ebb57 ("ice/ptp: Remove convert_art_to_tsc()")

My understanding is that the patch cited above (d4bea547ebb57) introduced the bug being addressed. And that it did so by incorrectly using the infrastructure added by the patch cited below (6b2e29977518e).

Thus, as the aim is to highlight which commit introduced the bug, I think that only the fixes tag above should be present (and the one below should be removed).

Quoted 1 line

Fixes" 6b2e29977518e ("timekeeping: Provide infrastructure for converting to/from a base clock")

Not strictly relevant if this tag is removed (see above) but the correct syntax is Fixes: ... (not Fixes" ...).

Quoted 3 lines

The code change itself looks correct to me.

...

#2 lore raw
Quoted 6 lines · Simon Horman
Quoted 5 lines · Anton Nadezhdin

Set use_nsecs=true as timestamp is reported in ns. Lack of this result in smaller timestamp error window which cause error during phc2sys execution on E825 NICs:
phc2sys[1768.256]: ioctl PTP_SYS_OFFSET_PRECISE: Invalid argument

Quoted 7 lines
Quoted 1 line

Before commit "Provide infrastructure for converting to/from a base clock"

Hi Anton,

Thanks for your patch.

I have some feedback on the form of the commit message, I hope it is useful.

Hi Simon,

Thank you for the feedback. I will go with such description in the next version:
ice/ptp: fix crosstimestamp reporting

Set use_nsecs=true as timestamp is reported in ns. Lack of this result in smaller timestamp error window which cause error during phc2sys execution on E825 NICs:
phc2sys[1768.256]: ioctl PTP_SYS_OFFSET_PRECISE: Invalid argument

This problem was introduced in the cited commit which omitted setting use_nsecs to true when converting the ice driver to use convert_base_to_cs().

Testing hints (ethX is PF netdev):
phc2sys -s ethX -c CLOCK_REALTIME -O 37 -m
phc2sys[1769.256]: CLOCK_REALTIME phc offset -5 s0 freq -0 delay 0

Quoted 2 lines

...