From: Miroslav Lichvar Date: Wed, 10 Apr 2024 10:05:57 +0000 (+0200) Subject: sys_linux: disable other external timestamping channels X-Git-Tag: 4.6-pre1~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a914140bd460b921ab6fd6fb29eb572f77d83a5b;p=thirdparty%2Fchrony.git sys_linux: disable other external timestamping channels Use new ioctls added in Linux 6.7 to disable receiving events from other channels when enabling external timestamping on a PHC. This should save some CPU time when other applications or chronyd instances are using other channels of the same PHC. --- diff --git a/sys_linux.c b/sys_linux.c index 68496375..5fe9c0ec 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -990,6 +990,14 @@ SYS_Linux_SetPHCExtTimestamping(int fd, int pin, int channel, return 0; } +#if defined(PTP_MASK_CLEAR_ALL) && defined(PTP_MASK_EN_SINGLE) + /* Disable events from other channels on this descriptor */ + if (ioctl(fd, PTP_MASK_CLEAR_ALL)) + DEBUG_LOG("ioctl(%s) failed : %s", "PTP_MASK_CLEAR_ALL", strerror(errno)); + else if (ioctl(fd, PTP_MASK_EN_SINGLE, &channel)) + DEBUG_LOG("ioctl(%s) failed : %s", "PTP_MASK_EN_SINGLE", strerror(errno)); +#endif + return 1; }