Tara Subedi 12e86c6fa5 PTP: smooth/transparent HA switchover
Currently we have following inconsistency between linuxptp and
ptp-notification app.
1) pmc_agent.cc: PMC polling interval (PMC_UPDATE_INTERVAL of 60
sec on pmc_agent_update)
2) ptp-notification app: 'overalltracker_context': {'holdover_seconds':
'15'}

In context of HA switchover, there is pmc polling in 60 sec interval
(pmc_agent_update uses PMC_UPDATE_INTERVAL i.e 60s ). This means when
primary ptp source lost, it would take 60 sec to switchover to secondary
clock.
On ptp-application app side, we have 'ptptracker_context':
{'holdover_seconds': 15} 'overalltracker_context': {'holdover_seconds':
'15'} With this, when the selected ptp source is lost more than 15 sec,
the ptp state and overall state would go holdover and then freerun.

For smooth transition, PMC_UPDATE_INTERVAL should be <<
holdover_seconds. This commit introduces configurable value for
PMC_UPDATE_INTERVAL with "phc2sys .. -p <int value [1, 3600]>",
and without configuration, the default value would be of 7 sec.

TEST PLAN:
PASS: deploy PTP with HA phy2sys parameter of "-p 60"
        or with file global parameter "pmc_update_interval_sec 60"
      stop primary ptp4l instance and check users.log to see
      the "timeout reading pmc" in 60 secs.
PASS: deploy PTP with HA Phy2sys without parameter of "-p"
      stop primary ptp4l instance and check users.log to see
      the "timeout reading pmc" in 7 secs.
      check HA switchover happens in 7 secs, and overall
      state won't change from Locked to holdover/freerun.

Story: 2011370
Task: 52061

Change-Id: I8a9123b15acbbff41954db42822b9f501cd5f2c9
Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
2025-04-29 15:45:08 -04:00
..