Tara Nath Subedi 5dea1c7b7f Add workaround for stale ptp4l parent_data_set in T-GM
When a T-GM node's ptp4l instance is connected to a T-BC node's
ptp4l instance that has clockclass 135/165, the parent_data_set
can become stale if an announce message is received before the
GRANDMASTER_SETTINGS_NP clockclass is set to 6/7. This causes
the connected T-BC to receive stale clockclass 135/165 announcements,
leaving its port state stuck as master.

Add workaround_for_stale_parent_data_set() which detects the
248 -> 6 clockclass transition in GRANDMASTER_SETTINGS_NP and
checks if PARENT_DATA_SET still holds a stale clockclass of
135 or 165. If so, incoming PTP traffic will be blocked and the
ptp4l service restarted to force re-synchronization, then
unblocked on the subsequent transition.

The function is called from check_clock_class() after writing
the grandmaster settings.

TEST PLAN:
PASS: T-GM controller-0 --  T-BC controller-1 Full-PTP setup
      (2 ptp4l instances on each node)
      T-BC: PORT_DATA_SET: slave, PARENT_DATA_SET: clockclass 6
      T-GM: systemctl stop ptp4l@ptp1.service
      T-BC: PORT_DATA_SET: master, PARENT_DATA_SET: clockclass 135
      T-GM: systemctl start ptp4l@ptp1.service
      T-BC: PORT_DATA_SET: slave, PARENT_DATA_SET: clockclass 6
      T-GM: PORT_DATA_SET: master, PARENT_DATA_SET: clockclass 6
            grep -E "Blocked | Unblocked | Restarted" /var/log/collectd.log
            14:48:45.203 info ptp plugin instance ptp1 Blocked PTP traffic on enp81s0f2, rule ID 15359
            14:48:45.266 info ptp plugin instance ptp1 Blocked PTP traffic on enp81s0f1, rule ID 15359
            14:48:45.359 info ptp plugin Restarted ptp4l@ptp1.service
            14:49:15.391 info ptp plugin instance ptp1 Unblocked PTP traffic on enp81s0f2, deleted rule ID 15359
            14:49:15.399 info ptp plugin instance ptp1 Unblocked PTP traffic on enp81s0f1, deleted rule ID 15359
PASS: multiple attempts (as above) gives same result
PASS: second ptp4l instance (ptp2) is not affected
PASS: Do above on both ptp instances on T-GM, T-BC comes back to Slave.
PASS: Test with vlan interface on both side of T-GM -- T-BC ptp4l instances

Story: 2011536
Task: 54005

Change-Id: Ib437e17ad082b0f8bb07a816abe25e7861cb798b
Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
2026-03-25 19:32:11 +00:00
2025-12-20 04:51:22 +00:00
2019-09-09 14:37:23 -05:00
2019-09-09 14:37:23 -05:00
2019-09-09 14:37:23 -05:00
Description
StarlingX system monitoring and repoting tools
5 MiB
Languages
Python 85.9%
Perl 13%
Makefile 1%
Shell 0.1%