]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys_linux: disable other external timestamping channels
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 10 Apr 2024 10:05:57 +0000 (12:05 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 10 Apr 2024 13:33:04 +0000 (15:33 +0200)
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.

sys_linux.c

index 68496375edb416cebaa3c29b379ad3ac257dd460..5fe9c0ec4fd9f376c2a47ad8abc0d0f437e5e793 100644 (file)
@@ -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;
 }