Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PPSi
Manage
Activity
Members
Labels
Plan
Issues
55
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
PPSi
Commits
a7ebba36
Commit
a7ebba36
authored
5 years ago
by
Jean-Claude BAU
Browse files
Options
Downloads
Patches
Plain Diff
Upgrade HA extension
parent
58ebc132
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arch-wrs/wrs-startup.c
+22
-23
22 additions, 23 deletions
arch-wrs/wrs-startup.c
proto-ext-l1sync/l1e-hooks.c
+72
-26
72 additions, 26 deletions
proto-ext-l1sync/l1e-hooks.c
proto-ext-l1sync/l1e-state-machine.c
+4
-4
4 additions, 4 deletions
proto-ext-l1sync/l1e-state-machine.c
with
98 additions
and
53 deletions
arch-wrs/wrs-startup.c
+
22
−
23
View file @
a7ebba36
...
...
@@ -307,19 +307,19 @@ int main(int argc, char **argv)
break
;
case
PPSI_PROFILE_HA
:
#if CONFIG_HAS_PROFILE_HA
if
(
!
enable_l1Sync
(
ppi
,
TRUE
)
)
goto
exit_out_of_memory
;
/* Force mandatory attributes - Do not take care of the configuration */
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
L1SyncEnabled
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
=
FALSE
;
enable_asymmetryCorrection
(
ppi
,
TRUE
);
}
if
(
!
enable_l1Sync
(
ppi
,
TRUE
)
)
goto
exit_out_of_memory
;
/* Force mandatory attributes - Do not take care of the configuration */
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
L1SyncEnabled
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
=
FALSE
;
enable_asymmetryCorrection
(
ppi
,
TRUE
);
#else
fprintf
(
stderr
,
"ppsi: Profile HA not supported"
);
exit
(
1
);
fprintf
(
stderr
,
"ppsi: Profile HA not supported"
);
exit
(
1
);
#endif
break
;
case
PPSI_PROFILE_PTP
:
...
...
@@ -331,17 +331,16 @@ int main(int argc, char **argv)
#if CONFIG_HAS_PROFILE_CUSTOM
ppi
->
protocol_extension
=
PPSI_EXT_NONE
;
/* can be changed ...*/
#if CONFIG_HAS_EXT_L1SYNC
if
(
ppi
->
cfg
.
l1SyncEnabled
)
{
if
(
!
enable_l1Sync
(
ppi
,
TRUE
)
)
goto
exit_out_of_memory
;
/* Read L1SYNC parameters */
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
ppi
->
cfg
.
l1SyncRxCoherencyIsRequired
;
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
ppi
->
cfg
.
l1SyncTxCoherencyIsRequired
;
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
ppi
->
cfg
.
l1SyncCongruencyIsRequired
;
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
=
ppi
->
cfg
.
l1SyncOptParamsEnabled
;
if
(
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
)
{
L1E_DSPOR_OP
(
ppi
)
->
timestampsCorrectedTx
=
ppi
->
cfg
.
l1SyncOptParamsTimestampsCorrectedTx
;
}
if
(
ppi
->
cfg
.
l1SyncEnabled
)
{
if
(
!
enable_l1Sync
(
ppi
,
TRUE
)
)
goto
exit_out_of_memory
;
/* Read L1SYNC parameters */
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
ppi
->
cfg
.
l1SyncRxCoherencyIsRequired
;
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
ppi
->
cfg
.
l1SyncTxCoherencyIsRequired
;
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
ppi
->
cfg
.
l1SyncCongruencyIsRequired
;
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
=
ppi
->
cfg
.
l1SyncOptParamsEnabled
;
if
(
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
)
{
L1E_DSPOR_OP
(
ppi
)
->
timestampsCorrectedTx
=
ppi
->
cfg
.
l1SyncOptParamsTimestampsCorrectedTx
;
}
}
enable_asymmetryCorrection
(
ppi
,
ppi
->
cfg
.
asymmetryCorrectionEnable
);
...
...
This diff is collapsed.
Click to expand it.
proto-ext-l1sync/l1e-hooks.c
+
72
−
26
View file @
a7ebba36
...
...
@@ -86,7 +86,7 @@ static int l1e_init(struct pp_instance *ppi, void *buf, int len)
/* Init configuration members of L1SyncOptParamsPortDS */
L1E_DSPOR_OP
(
ppi
)
->
timestampsCorrectedTx
=
TRUE
;
ppi
->
ext_enabled
=
TRUE
;
ppi
->
pdstate
=
PP_PDSTATE_WAIT_MSG
;
return
0
;
}
...
...
@@ -104,7 +104,10 @@ static int l1e_handle_signaling(struct pp_instance * ppi, void *buf, int len)
pp_timeout_set
(
ppi
,
L1E_TIMEOUT_RX_SYNC
,
l1e_get_rx_tmo_ms
(
bds
));
bds
->
L1SyncLinkAlive
=
TRUE
;
lstate_enable_extension
(
ppi
);
if
(
ppi
->
extState
==
PP_EXSTATE_PTP
)
{
// Extension need to be re-enabled
pdstate_enable_extension
(
ppi
);
}
}
return
0
;
}
...
...
@@ -123,8 +126,10 @@ static int l1e_handle_resp(struct pp_instance *ppi)
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
/* This correction_field we received is already part of t4 */
if
(
ppi
->
ext_enabled
)
{
l1e_servo_got_resp
(
ppi
);
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
)
{
wr_servo_got_resp
(
ppi
);
if
(
ppi
->
pdstate
==
PP_PDSTATE_PDETECTED
)
pdstate_set_state_pdetected
(
ppi
);
// Maintain state Protocol detected on MASTER side
}
else
{
pp_servo_got_resp
(
ppi
,
OPTS
(
ppi
)
->
ptpFallbackPpsGen
);
...
...
@@ -132,8 +137,20 @@ static int l1e_handle_resp(struct pp_instance *ppi)
return
0
;
}
static
int
l1e_handle_dreq
(
struct
pp_instance
*
ppi
)
{
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
)
{
if
(
ppi
->
pdstate
==
PP_PDSTATE_PDETECTED
)
pdstate_set_state_pdetected
(
ppi
);
// Maintain state Protocol detected on MASTER side
}
return
0
;
}
static
int
l1e_sync_followup
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
ext
_enabled
)
{
if
(
ppi
->
ext
State
==
PP_EXSTATE_ACTIVE
)
{
l1e_servo_got_sync
(
ppi
);
}
else
{
...
...
@@ -159,9 +176,11 @@ static int l1e_handle_sync(struct pp_instance *ppi)
static
int
l1e_handle_presp
(
struct
pp_instance
*
ppi
)
{
/* FIXME: verify that last-received cField is already accounted for */
if
(
ppi
->
ext_enabled
)
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
)
{
l1e_servo_got_presp
(
ppi
);
if
(
ppi
->
pdstate
==
PP_PDSTATE_PDETECTED
)
pdstate_set_state_pdetected
(
ppi
);
// Maintain state Protocol detected on MASTER side
}
else
pp_servo_got_presp
(
ppi
);
return
0
;
...
...
@@ -181,34 +200,38 @@ static void l1e_state_change(struct pp_instance *ppi) {
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
if
(
!
ppi
->
ext_enabled
)
return
;
switch
(
ppi
->
next_state
)
{
case
PPS_DISABLED
:
/* In PPSI we go to DISABLE state when the link is down */
/* For the time being, it should be done like this because fsm is not called when the link is down */
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
/* Force L1Sync DISABLE state */
l1e_run_state_machine
(
ppi
,
NULL
,
0
);
break
;
case
PPS_INITIALIZING
:
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
=
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
break
;
if
(
ppi
->
extState
==
PP_EXSTATE_PTP
&&
ppi
->
next_state
==
PPS_UNCALIBRATED
)
{
// Extension need to be re-enabled
pdstate_enable_extension
(
ppi
);
}
if
(
ppi
->
state
==
PPS_SLAVE
&&
ppi
->
next_state
!=
PPS_UNCALIBRATED
)
{
/* Leave SLAVE state : We must stop the PPS generation */
TOPS
(
ppi
)
->
enable_timing_output
(
GLBS
(
ppi
),
0
);
WRH_OPER
()
->
locking_reset
(
ppi
);
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
)
{
switch
(
ppi
->
next_state
)
{
case
PPS_DISABLED
:
/* In PPSI we go to DISABLE state when the link is down */
/* For the time being, it should be done like this because fsm is not called when the link is down */
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
/* Force L1Sync DISABLE state */
l1e_run_state_machine
(
ppi
,
NULL
,
0
);
break
;
case
PPS_INITIALIZING
:
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
=
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
break
;
}
if
(
ppi
->
state
==
PPS_SLAVE
&&
ppi
->
next_state
!=
PPS_UNCALIBRATED
)
{
/* Leave SLAVE state : We must stop the PPS generation */
TOPS
(
ppi
)
->
enable_timing_output
(
GLBS
(
ppi
),
0
);
WRH_OPER
()
->
locking_reset
(
ppi
);
}
}
}
static
int
l1e_new_slave
(
struct
pp_instance
*
ppi
,
void
*
buf
,
int
len
)
{
if
(
ppi
->
ext
_enabled
)
if
(
ppi
->
ext
State
==
PP_EXSTATE_ACTIVE
)
l1e_servo_init
(
ppi
);
return
0
;
}
static
int
l1e_require_precise_timestamp
(
struct
pp_instance
*
ppi
)
{
return
ppi
->
ext
_enabled
?
L1E_DSPOR_BS
(
ppi
)
->
L1SyncState
==
L1SYNC_UP
:
0
;
return
ppi
->
ext
State
==
PP_EXSTATE_ACTIVE
?
L1E_DSPOR_BS
(
ppi
)
->
L1SyncState
==
L1SYNC_UP
:
0
;
}
static
int
l1e_get_tmo_lstate_detection
(
struct
pp_instance
*
ppi
)
{
...
...
@@ -217,6 +240,23 @@ static int l1e_get_tmo_lstate_detection(struct pp_instance *ppi) {
l1e_get_rx_tmo_ms
(
L1E_DSPOR_BS
(
ppi
));
}
static
TimeInterval
l1e_get_ingress_latency
(
struct
pp_instance
*
ppi
)
{
return
ppi
->
timestampCorrectionPortDS
.
ingressLatency
;
}
static
TimeInterval
l1e_get_egress_latency
(
struct
pp_instance
*
ppi
)
{
return
ppi
->
timestampCorrectionPortDS
.
egressLatency
;
}
/* HA extension is compliant with the standard concerning the contents of the correction fields */
static
int
l1e_is_correction_field_compliant
(
struct
pp_instance
*
ppi
)
{
return
1
;
}
static
int
l1e_extension_state_changed
(
struct
pp_instance
*
ppi
)
{
return
0
;
}
/* The global structure used by ppsi */
struct
pp_ext_hooks
l1e_ext_hooks
=
{
.
open
=
l1e_open
,
...
...
@@ -225,6 +265,7 @@ struct pp_ext_hooks l1e_ext_hooks = {
.
run_ext_state_machine
=
l1e_run_state_machine
,
.
ready_for_slave
=
l1e_ready_for_slave
,
.
handle_resp
=
l1e_handle_resp
,
.
handle_dreq
=
l1e_handle_dreq
,
.
handle_sync
=
l1e_handle_sync
,
.
handle_followup
=
l1e_handle_followup
,
.
new_slave
=
l1e_new_slave
,
...
...
@@ -234,6 +275,11 @@ struct pp_ext_hooks l1e_ext_hooks = {
.
state_change
=
l1e_state_change
,
.
servo_reset
=
l1e_servo_reset
,
.
require_precise_timestamp
=
l1e_require_precise_timestamp
,
.
get_tmo_lstate_detection
=
l1e_get_tmo_lstate_detection
.
get_tmo_lstate_detection
=
l1e_get_tmo_lstate_detection
,
.
get_ingress_latency
=
l1e_get_ingress_latency
,
.
get_egress_latency
=
l1e_get_egress_latency
,
.
is_correction_field_compliant
=
l1e_is_correction_field_compliant
,
.
extension_state_changed
=
l1e_extension_state_changed
};
This diff is collapsed.
Click to expand it.
proto-ext-l1sync/l1e-state-machine.c
+
4
−
4
View file @
a7ebba36
...
...
@@ -59,7 +59,7 @@ int l1e_run_state_machine(struct pp_instance *ppi, void *buf, int len) {
int
*
execute_state_machine
=&
L1E_DSPOR
(
ppi
)
->
execute_state_machine
;
int
delay
;
if
(
!
ppi
->
ext
_enabled
||
ppi
->
state
==
PPS_INITIALIZING
)
if
(
ppi
->
ext
State
!=
PP_EXSTATE_ACTIVE
||
ppi
->
state
==
PPS_INITIALIZING
)
return
INT_MAX
;
/* Return a big delay. fsm will then not use it */
if
(
nextState
>=
MAX_STATE_ACTIONS
)
...
...
@@ -281,7 +281,7 @@ static int l1e_handle_state_idle(struct pp_instance *ppi, Boolean new_state){
if
(
!
le1_evt_L1_SYNC_ENABLED
(
ppi
)
||
le1_evt_L1_SYNC_RESET
(
ppi
)
)
{
/* Go to DISABLE state */
l1e_portDS
->
basic
.
next_state
=
L1SYNC_DISABLED
;
l
state_
set_link_failure
(
ppi
);
pd
state_
disable_extension
(
ppi
);
return
0
;
/* Treatment required asap */
}
if
(
le1_evt_LINK_OK
(
ppi
)
)
{
...
...
@@ -379,7 +379,7 @@ static int l1e_handle_state_up(struct pp_instance *ppi, Boolean new_state){
if
(
!
le1_evt_LINK_OK
(
ppi
)
)
{
/* Go to IDLE state */
next_state
=
L1SYNC_IDLE
;
l
state_
set_link_failure
(
ppi
);
pd
state_
disable_extension
(
ppi
);
}
if
(
!
le1_evt_CONFIG_OK
(
ppi
)
)
{
/* Return to LINK_ALIVE state */
...
...
@@ -397,7 +397,7 @@ static int l1e_handle_state_up(struct pp_instance *ppi, Boolean new_state){
}
/* Iterative treatment */
l
state_
set_link_established
(
ppi
);
pd
state_
enable_extension
(
ppi
);
wrh_update_correction_values
(
ppi
);
l1e_send_sync_msg
(
ppi
,
0
);
return
pp_next_delay_2
(
ppi
,
L1E_TIMEOUT_TX_SYNC
,
L1E_TIMEOUT_RX_SYNC
);
/* Return the shorter timeout */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment