Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'ptp-provide-support-for-auxiliary-clocks-for-ptp_sys_offset_extended'

Thomas Gleixner says:

====================
ptp: Provide support for auxiliary clocks for PTP_SYS_OFFSET_EXTENDED

This is a follow up to the V1 series, which can be found here:

https://lore.kernel.org/all/20250626124327.667087805@linutronix.de

to address the merge logistics problem, which I created myself.

Changes vs. V1:

- Make patch 1, which provides the timestamping function temporarily
define CLOCK_AUX* if undefined so that it can be merged independently,

- Add a missing check for CONFIG_POSIX_AUX_CLOCK in the PTP IOCTL

- Picked up tags

Merge logistics if agreed on:

1) Patch #1 is applied to the tip tree on top of plain v6.16-rc1 and
tagged

2) That tag is merged into tip:timers/ptp and the temporary CLOCK_AUX
define is removed in a subsequent commit

3) Network folks merge the tag and apply patches #2 + #3

So the only fallout from this are the extra merges in both trees and the
cleanup commit in the tip tree. But that way there are no dependencies and
no duplicate commits with different SHAs.

Thoughts?

Due to the above constraints there is no branch offered to pull from right
now. Sorry for the inconveniance. Should have thought about that earlier.
====================

Link: https://patch.msgid.link/20250701130923.579834908@linutronix.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Paolo Abeni 792eacd3 4f38a6db

+23 -35
+19 -5
drivers/ptp/ptp_chardev.c
··· 325 325 if (IS_ERR(extoff)) 326 326 return PTR_ERR(extoff); 327 327 328 - if (extoff->n_samples > PTP_MAX_SAMPLES || 329 - extoff->rsv[0] || extoff->rsv[1] || 330 - (extoff->clockid != CLOCK_REALTIME && 331 - extoff->clockid != CLOCK_MONOTONIC && 332 - extoff->clockid != CLOCK_MONOTONIC_RAW)) 328 + if (extoff->n_samples > PTP_MAX_SAMPLES || extoff->rsv[0] || extoff->rsv[1]) 333 329 return -EINVAL; 330 + 331 + switch (extoff->clockid) { 332 + case CLOCK_REALTIME: 333 + case CLOCK_MONOTONIC: 334 + case CLOCK_MONOTONIC_RAW: 335 + break; 336 + case CLOCK_AUX ... CLOCK_AUX_LAST: 337 + if (IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS)) 338 + break; 339 + fallthrough; 340 + default: 341 + return -EINVAL; 342 + } 334 343 335 344 sts.clockid = extoff->clockid; 336 345 for (unsigned int i = 0; i < extoff->n_samples; i++) { ··· 349 340 err = ptp->info->gettimex64(ptp->info, &ts, &sts); 350 341 if (err) 351 342 return err; 343 + 344 + /* Filter out disabled or unavailable clocks */ 345 + if (sts.pre_ts.tv_sec < 0 || sts.post_ts.tv_sec < 0) 346 + return -EINVAL; 347 + 352 348 extoff->ts[i][0].sec = sts.pre_ts.tv_sec; 353 349 extoff->ts[i][0].nsec = sts.pre_ts.tv_nsec; 354 350 extoff->ts[i][1].sec = ts.tv_sec;
+4 -30
include/linux/ptp_clock_kernel.h
··· 477 477 478 478 static inline void ptp_read_system_prets(struct ptp_system_timestamp *sts) 479 479 { 480 - if (sts) { 481 - switch (sts->clockid) { 482 - case CLOCK_REALTIME: 483 - ktime_get_real_ts64(&sts->pre_ts); 484 - break; 485 - case CLOCK_MONOTONIC: 486 - ktime_get_ts64(&sts->pre_ts); 487 - break; 488 - case CLOCK_MONOTONIC_RAW: 489 - ktime_get_raw_ts64(&sts->pre_ts); 490 - break; 491 - default: 492 - break; 493 - } 494 - } 480 + if (sts) 481 + ktime_get_clock_ts64(sts->clockid, &sts->pre_ts); 495 482 } 496 483 497 484 static inline void ptp_read_system_postts(struct ptp_system_timestamp *sts) 498 485 { 499 - if (sts) { 500 - switch (sts->clockid) { 501 - case CLOCK_REALTIME: 502 - ktime_get_real_ts64(&sts->post_ts); 503 - break; 504 - case CLOCK_MONOTONIC: 505 - ktime_get_ts64(&sts->post_ts); 506 - break; 507 - case CLOCK_MONOTONIC_RAW: 508 - ktime_get_raw_ts64(&sts->post_ts); 509 - break; 510 - default: 511 - break; 512 - } 513 - } 486 + if (sts) 487 + ktime_get_clock_ts64(sts->clockid, &sts->post_ts); 514 488 } 515 489 516 490 #endif