Commit 765c661b authored by baujc's avatar baujc

Suppress timer PP_TO_FAULT

After reviewing the code with Maciej, this time-out does not seem to be
used in a very coherent way. We decided then to remove it.
parent 25692a35
...@@ -36,7 +36,6 @@ enum pp_timeouts { ...@@ -36,7 +36,6 @@ enum pp_timeouts {
PP_TO_BMC, PP_TO_BMC,
PP_TO_ANN_RECEIPT, PP_TO_ANN_RECEIPT,
PP_TO_ANN_SEND, PP_TO_ANN_SEND,
PP_TO_FAULT,
PP_TO_QUALIFICATION, PP_TO_QUALIFICATION,
PP_TO_PROT_STATE, PP_TO_PROT_STATE,
PP_TO_IN_STATE, PP_TO_IN_STATE,
......
...@@ -128,11 +128,6 @@ int wr_execute_slave(struct pp_instance *ppi) ...@@ -128,11 +128,6 @@ int wr_execute_slave(struct pp_instance *ppi)
{ {
pp_diag(ppi, ext, 2, "hook: %s\n", __func__); pp_diag(ppi, ext, 2, "hook: %s\n", __func__);
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi)) ) {
if (pp_timeout(ppi, PP_TO_FAULT))
wr_servo_reset(ppi); /* the caller handles ptp state machine */
}
if ((ppi->state == PPS_SLAVE) && if ((ppi->state == PPS_SLAVE) &&
(WR_DSPOR(ppi)->wrConfig & WR_S_ONLY) && (WR_DSPOR(ppi)->wrConfig & WR_S_ONLY) &&
(WR_DSPOR(ppi)->parentWrConfig & WR_M_ONLY) && (WR_DSPOR(ppi)->parentWrConfig & WR_M_ONLY) &&
......
...@@ -20,9 +20,6 @@ static int presp_call_servo(struct pp_instance *ppi) ...@@ -20,9 +20,6 @@ static int presp_call_servo(struct pp_instance *ppi)
if (is_incorrect(&ppi->t4)) if (is_incorrect(&ppi->t4))
return 0; /* not an error, just no data */ return 0; /* not an error, just no data */
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi)) )
pp_timeout_reset(ppi, PP_TO_FAULT);
if (is_ext_hook_available(ppi,handle_presp)) if (is_ext_hook_available(ppi,handle_presp))
ret = ppi->ext_hooks->handle_presp(ppi); ret = ppi->ext_hooks->handle_presp(ppi);
else { else {
......
...@@ -57,8 +57,6 @@ static void _pp_servo_init(struct pp_instance *ppi) ...@@ -57,8 +57,6 @@ static void _pp_servo_init(struct pp_instance *ppi)
servo->flags |= PP_SERVO_FLAG_VALID; servo->flags |= PP_SERVO_FLAG_VALID;
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi)) )
pp_timeout_reset(ppi, PP_TO_FAULT);
pp_diag(ppi, servo, 1, "Initialized: obs_drift %lli\n", pp_diag(ppi, servo, 1, "Initialized: obs_drift %lli\n",
servo->obs_drift); servo->obs_drift);
} }
......
...@@ -51,17 +51,14 @@ int pp_listening(struct pp_instance *ppi, void *buf, int len) ...@@ -51,17 +51,14 @@ int pp_listening(struct pp_instance *ppi, void *buf, int len)
int e = 0; /* error var, to check errors in msg handling */ int e = 0; /* error var, to check errors in msg handling */
MsgHeader *hdr = &ppi->received_ptp_header; MsgHeader *hdr = &ppi->received_ptp_header;
if ( is_externalPortConfigurationEnabled(DSDEF(ppi)) ) { if (is_ext_hook_available(ppi,listening)) {
if (is_ext_hook_available(ppi,listening)) e=ppi->ext_hooks->listening(ppi, buf, len);
e=ppi->ext_hooks->listening(ppi, buf, len); if ( e ) {
if ( e ) if (is_externalPortConfigurationEnabled(DSDEF(ppi)) )
goto epc_out; goto epc_out;
} else { else
pp_timeout_reset(ppi, PP_TO_FAULT); /* no fault as long as we listen */ goto out;
if (is_ext_hook_available(ppi,listening)) }
e = ppi->ext_hooks->listening(ppi, buf, len);
if ( e )
goto out;
} }
/* when the clock is using peer-delay, listening must send it too */ /* when the clock is using peer-delay, listening must send it too */
...@@ -86,9 +83,6 @@ int pp_listening(struct pp_instance *ppi, void *buf, int len) ...@@ -86,9 +83,6 @@ int pp_listening(struct pp_instance *ppi, void *buf, int len)
st_com_check_announce_receive_timeout(ppi); st_com_check_announce_receive_timeout(ppi);
if (pp_timeout(ppi, PP_TO_FAULT))
ppi->next_state = PPS_FAULTY;
out:; out:;
if (e != 0) if (e != 0)
ppi->next_state = PPS_FAULTY; ppi->next_state = PPS_FAULTY;
......
...@@ -69,11 +69,6 @@ int pp_master(struct pp_instance *ppi, void *buf, int len) ...@@ -69,11 +69,6 @@ int pp_master(struct pp_instance *ppi, void *buf, int len)
int pre = (ppi->state == PPS_PRE_MASTER); int pre = (ppi->state == PPS_PRE_MASTER);
int e = 0; /* error var, to check errors in msg handling */ int e = 0; /* error var, to check errors in msg handling */
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi))) {
/* no fault as long as we are master */
pp_timeout_reset(ppi, PP_TO_FAULT);
}
/* upgrade from pre-master to master */ /* upgrade from pre-master to master */
if (!is_externalPortConfigurationEnabled(DSDEF(ppi)) && if (!is_externalPortConfigurationEnabled(DSDEF(ppi)) &&
pre && pre &&
...@@ -127,11 +122,6 @@ int pp_master(struct pp_instance *ppi, void *buf, int len) ...@@ -127,11 +122,6 @@ int pp_master(struct pp_instance *ppi, void *buf, int len)
msgtype); msgtype);
} }
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi))) {
if (pp_timeout(ppi, PP_TO_FAULT))
ppi->next_state = PPS_FAULTY;
}
out: out:
if ( is_externalPortConfigurationEnabled(DSDEF(ppi))) { if ( is_externalPortConfigurationEnabled(DSDEF(ppi))) {
if ( e==PP_SEND_ERROR || e==PP_SEND_NO_STAMP ) if ( e==PP_SEND_ERROR || e==PP_SEND_NO_STAMP )
......
...@@ -68,11 +68,6 @@ int pp_passive(struct pp_instance *ppi, void *buf, int len) ...@@ -68,11 +68,6 @@ int pp_passive(struct pp_instance *ppi, void *buf, int len)
int e = 0; /* error var, to check errors in msg handling */ int e = 0; /* error var, to check errors in msg handling */
MsgHeader *hdr = &ppi->received_ptp_header; MsgHeader *hdr = &ppi->received_ptp_header;
if ( ! is_externalPortConfigurationEnabled(DSDEF(ppi)) ) {
/* no fault as long as we are passive */
pp_timeout_reset(ppi, PP_TO_FAULT);
}
/* when the clock is using peer-delay, passive must send it too */ /* when the clock is using peer-delay, passive must send it too */
if ( is_delayMechanismP2P(ppi) ) if ( is_delayMechanismP2P(ppi) )
e = pp_lib_may_issue_request(ppi); e = pp_lib_may_issue_request(ppi);
...@@ -102,7 +97,7 @@ int pp_passive(struct pp_instance *ppi, void *buf, int len) ...@@ -102,7 +97,7 @@ int pp_passive(struct pp_instance *ppi, void *buf, int len)
pp_next_delay_2(ppi,PP_TO_ANN_RECEIPT, PP_TO_REQUEST) : pp_next_delay_2(ppi,PP_TO_ANN_RECEIPT, PP_TO_REQUEST) :
pp_next_delay_1(ppi,PP_TO_ANN_RECEIPT); pp_next_delay_1(ppi,PP_TO_ANN_RECEIPT);
if (pp_timeout(ppi, PP_TO_FAULT) || e !=0 ) if ( e !=0 )
ppi->next_state = PPS_FAULTY; ppi->next_state = PPS_FAULTY;
} }
......
...@@ -159,9 +159,6 @@ static int slave_handle_response(struct pp_instance *ppi, void *buf, ...@@ -159,9 +159,6 @@ static int slave_handle_response(struct pp_instance *ppi, void *buf,
pp_time_add(&ppi->t4, &hdr->cField); pp_time_add(&ppi->t4, &hdr->cField);
/* WARNING: should be "sub" (see README-cfield::BUG) */ /* WARNING: should be "sub" (see README-cfield::BUG) */
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi)) )
pp_timeout_reset(ppi, PP_TO_FAULT);
if (is_ext_hook_available(ppi,handle_resp)) { if (is_ext_hook_available(ppi,handle_resp)) {
ret=ppi->ext_hooks->handle_resp(ppi); ret=ppi->ext_hooks->handle_resp(ppi);
} }
...@@ -259,13 +256,8 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len) ...@@ -259,13 +256,8 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
} else { } else {
ppi->next_state = PPS_SLAVE; ppi->next_state = PPS_SLAVE;
} }
} else {
if ( !is_externalPortConfigurationEnabled(DSDEF(ppi)) ) {
/* TODO add implementation specific SYNCHRONIZATION event */
if (pp_timeout(ppi, PP_TO_FAULT))
ppi->next_state = PPS_UNCALIBRATED;
}
} }
/* Force to stay on desired state if externalPortConfiguration option is enabled */ /* Force to stay on desired state if externalPortConfiguration option is enabled */
if (is_externalPortConfigurationEnabled(DSDEF(ppi)) ) if (is_externalPortConfigurationEnabled(DSDEF(ppi)) )
ppi->next_state = ppi->externalPortConfigurationPortDS.desiredState; ppi->next_state = ppi->externalPortConfigurationPortDS.desiredState;
......
...@@ -150,14 +150,9 @@ void pp_timeout_init(struct pp_instance *ppi) ...@@ -150,14 +150,9 @@ void pp_timeout_init(struct pp_instance *ppi)
*/ */
if ( is_externalPortConfigurationEnabled(DSDEF(ppi)) ) { if ( is_externalPortConfigurationEnabled(DSDEF(ppi)) ) {
tmoCnt[PP_TO_ANN_RECEIPT].initValueMs = tmoCnt[PP_TO_ANN_RECEIPT].initValueMs =
tmoCnt[PP_TO_FAULT].initValueMs= tmoCnt[PP_TO_QUALIFICATION].initValueMs =TIMEOUT_DISABLE_VALUE;
tmoCnt[PP_TO_QUALIFICATION].initValueMs =TIMEOUT_DISABLE_VALUE;
} else { } else {
tmoCnt[PP_TO_ANN_RECEIPT].initValueMs=1000 * (port->announceReceiptTimeout << port->logAnnounceInterval); tmoCnt[PP_TO_ANN_RECEIPT].initValueMs=1000 * (port->announceReceiptTimeout << port->logAnnounceInterval);
/* fault timeout is 4 avg request intervals, not randomized */
tmoCnt[PP_TO_FAULT].initValueMs = pp_timeout_log_to_ms(logDelayRequest);
if ( tmoCnt[PP_TO_FAULT].initValueMs < (TIMEOUT_MAX_VALUE_MS>>2))
tmoCnt[PP_TO_FAULT].initValueMs<<=2; /* We can multiply by 4. No risk of overload */
tmoCnt[PP_TO_QUALIFICATION].initValueMs = tmoCnt[PP_TO_QUALIFICATION].initValueMs =
(1000 << port->logAnnounceInterval)*(DSCUR(ppi)->stepsRemoved + 1); (1000 << port->logAnnounceInterval)*(DSCUR(ppi)->stepsRemoved + 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment