Latest Linux kernel has supported getting PHC from bond directly. This would help topology like VLAN over bond to get PHC natively. To achieve this, the new hwtstamp flag is needed when passing hwtstamp_config to kernel.
We use ifdef to check if the build kernel support this new flag. And fall back without flag if user run new build on old kernel for hwts_init(). # ./ptp4l -m -i bond0.23 ptp4l[682486.650]: selected /dev/ptp2 as PTP clock ptp4l[682486.652]: port 1 (bond0.23): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[682486.652]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[682486.652]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[682494.549]: port 1 (bond0.23): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[682494.549]: selected local clock f8bc12.fffe.13b6e0 as best master ptp4l[682494.549]: port 1 (bond0.23): assuming the grand master role ptp4l[682710.410]: Switched to /dev/ptp0 as PTP clock ptp4l[682710.410]: port 1 (bond0.23): MASTER to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED) ptp4l[682736.404]: port 1 (bond0.23): FAULTY to LISTENING on INIT_COMPLETE ptp4l[682742.989]: port 1 (bond0.23): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[682742.989]: port 1 (bond0.23): assuming the grand master role Change log: v3: remove ifdef in clock_create() and FD_RTNL event. v2: remove link state PHC_INDEX_CHANGED and use TS_LABEL_CHANGED only. Hangbin Liu (2): ptp4l: init iface->ts_label when interface created ptp4l: get bond phc directly if kernel support the new hwtstamp flag clock.c | 18 ++++++++---- e2e_tc.c | 8 +++++- interface.c | 8 +----- interface.h | 6 ---- nsm.c | 5 ++-- p2p_tc.c | 8 +++++- pmc_common.c | 1 - port.c | 75 +++++++++++++++++++++++++++++++------------------- port_private.h | 1 + sk.c | 7 +++++ 10 files changed, 85 insertions(+), 52 deletions(-) -- 2.31.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel