unix: add PTP IOCTLs on Linux

The IOCTLs are used for interacting with PTP-specific functions of NIC and time card drivers.

Description:
https://netdevconf.info/0x18/docs/netdev-0x18-paper39-talk-slides/netdev-intro-ptp-api.pdf

Change-Id: If50d605958e5cee451146cf68cc95a3704917512
GitHub-Last-Rev: 44fac1cb1a96b28050f9b9b0c2d986b0feba933f
GitHub-Pull-Request: golang/sys#225
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621375
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Yaroslav Kolomiiets
2024-10-21 18:42:12 +00:00
committed by Gopher Robot
parent adbb8bbcaf
commit 256d1dfe8f
21 changed files with 381 additions and 0 deletions
+22
View File
@@ -151,6 +151,7 @@ struct termios2 {
#include <linux/openat2.h>
#include <linux/perf_event.h>
#include <linux/pps.h>
#include <linux/ptp_clock.h>
#include <linux/random.h>
#include <linux/rtc.h>
#include <linux/rtnetlink.h>
@@ -525,6 +526,15 @@ struct cachestat {
__u64 nr_evicted;
__u64 nr_recently_evicted;
};
// the one defined in linux/ptp_clock.h has unions
struct my_ptp_perout_request {
struct ptp_clock_time startOrPhase; // start or phase
struct ptp_clock_time period;
unsigned int index;
unsigned int flags;
struct ptp_clock_time on;
};
*/
import "C"
@@ -4126,6 +4136,18 @@ const (
HWTSTAMP_TX_ONESTEP_SYNC = C.HWTSTAMP_TX_ONESTEP_SYNC
)
type (
PtpClockCaps C.struct_ptp_clock_caps
PtpClockTime C.struct_ptp_clock_time
PtpExttsEvent C.struct_ptp_extts_event
PtpExttsRequest C.struct_ptp_extts_request
PtpPeroutRequest C.struct_my_ptp_perout_request
PtpPinDesc C.struct_ptp_pin_desc
PtpSysOffset C.struct_ptp_sys_offset
PtpSysOffsetExtended C.struct_ptp_sys_offset_extended
PtpSysOffsetPrecise C.struct_ptp_sys_offset_precise
)
type (
HIDRawReportDescriptor C.struct_hidraw_report_descriptor
HIDRawDevInfo C.struct_hidraw_devinfo