RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Loading...
Searching...
No Matches
ab_gp_standby_policy.h File Reference

GP-specific standby and site-link constants, the session-adoption rule and the stall rule. More...

#include <stdbool.h>
#include <stdint.h>
#include "rte/redundancy/site_role/rte_site_role_policy.h"
#include "rte/utils/types/rte_types.h"
Include dependency graph for ab_gp_standby_policy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AB_GP_STALL_LOST_CONTACT_MS   5000U
#define AB_GP_NEG_RECONNECT_ATTEMPT_MS   50U
#define AB_GP_JOIN_ADOPT_CYCLES   40U

Functions

bool ab_gp_session_adopt_allowed (uint32_t join_left, bool local_in_use, bool peer_in_use)
 Whether a channel that has just become ONLINE adopts one train session from its A/B sibling.
bool ab_gp_stall_lost_contact (rte_timestamp_ms_t last_ms, rte_timestamp_ms_t now_ms, bool is_online, rte_timestamp_ms_t *stalled_ms)
 Whether a channel that wakes up at a cycle tick has stalled long enough to count as having lost contact.

Detailed Description

GP-specific standby and site-link constants, the session-adoption rule and the stall rule.

The generic site-role policy (decision table, standby sync / stale snapshot, takeover and both-STANDBY tie-break predicates and their constants) moved to Platform_RTE's rte_site_role_policy.h (ADR-040 step 1, the Capella model places it in RTE Redundancy Services). It is included here so existing includers keep compiling. What stays here is application specific or moves with ADR-040 step 2.

Definition in file ab_gp_standby_policy.h.

Macro Definition Documentation

◆ AB_GP_STALL_LOST_CONTACT_MS

#define AB_GP_STALL_LOST_CONTACT_MS   5000U

A stall this long (ms between two cycle ticks: process frozen, VM paused) is long enough for the counterpart to have taken over: an ONLINE channel that wakes up from it treats itself as having lost contact and yields to an ONLINE counterpart instead of raising a dual-ONLINE alarm.

Definition at line 22 of file ab_gp_standby_policy.h.

◆ AB_GP_NEG_RECONNECT_ATTEMPT_MS

#define AB_GP_NEG_RECONNECT_ATTEMPT_MS   50U

Time one per-cycle reconnect attempt of the inter-site link may block the cyclic executive (an answering peer needs a few ms).

Definition at line 25 of file ab_gp_standby_policy.h.

◆ AB_GP_JOIN_ADOPT_CYCLES

#define AB_GP_JOIN_ADOPT_CYCLES   40U

Cycles after a channel becomes ONLINE in which it may adopt a train session it missed from its A/B sibling.

Definition at line 28 of file ab_gp_standby_policy.h.

Function Documentation

◆ ab_gp_session_adopt_allowed()

bool ab_gp_session_adopt_allowed ( uint32_t join_left,
bool local_in_use,
bool peer_in_use )

Whether a channel that has just become ONLINE adopts one train session from its A/B sibling.

A channel that starts receiving later than its sibling (after a staggered restart, its relay from the Gateway is not flowing yet) can miss a train's connect; the session tables then differ and the A/B cross-compare would declare a divergence and reboot a channel. Within the join window, a session the sibling holds and this channel lacks is copied (the same kind of state transfer as at a promotion); everything after that is computed independently and cross-compared as usual. Anything else that differs is NOT adopted: it is a real divergence.

Parameters
join_leftcycles left in the join window (0 = closed)
local_in_usethis channel holds the session
peer_in_usethe A/B sibling holds the session
Returns
true to copy the sibling's session

Definition at line 9 of file ab_gp_standby_policy.c.

◆ ab_gp_stall_lost_contact()

bool ab_gp_stall_lost_contact ( rte_timestamp_ms_t last_ms,
rte_timestamp_ms_t now_ms,
bool is_online,
rte_timestamp_ms_t * stalled_ms )

Whether a channel that wakes up at a cycle tick has stalled long enough to count as having lost contact.

The rule of the stall detector in ab_gp_channel_wait_cycle_tick(): an ONLINE channel whose previous cycle tick is more than AB_GP_STALL_LOST_CONTACT_MS back treats itself as having lost contact (the caller then calls rte_site_role_note_lost_contact()). Both times are the full 64-bit monotonic time; the previous tick used to be kept in 32 bits, which made the difference wrong from 2^32 ms of monotonic time on (ISS-052).

now_ms smaller than last_ms gives a large unsigned difference, so the answer is true. That only happens when rte_timer_now() fails and leaves 0 in the caller's variable; the ignored status is ISS-036 and this function keeps the behaviour the detector had before.

Parameters
last_msmonotonic time of the previous cycle tick (0 = no cycle yet)
now_msmonotonic time of this cycle tick
is_onlinethis channel is ONLINE
stalled_msout, may be NULL: now_ms - last_ms, written only when the result is true
Returns
true when the channel is ONLINE, has a previous cycle tick and that tick is more than AB_GP_STALL_LOST_CONTACT_MS back; false otherwise

Definition at line 14 of file ab_gp_standby_policy.c.