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. Let's supply the flag first, and fall back without flag if user runs on old kernel.
# ./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: v6: revert changes in clock_create() in patch 2. v5: update patch 01 description v4: define HWTSTAMP_FLAG_BONDED_PHC_INDEX in missing.h remove unneeded net_tstamp header files 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 | 8 ++++-- e2e_tc.c | 7 ++++- interface.c | 8 +----- interface.h | 6 ---- missing.h | 6 ++++ nsm.c | 5 ++-- p2p_tc.c | 7 ++++- pmc_common.c | 1 - port.c | 74 +++++++++++++++++++++++++++++++------------------- port_private.h | 1 + sk.c | 5 ++++ 11 files changed, 78 insertions(+), 50 deletions(-) -- 2.35.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel