Commit a78aefb1 authored by Alessandro Rubini's avatar Alessandro Rubini

general: rename fields within ppsi (no technical change)

This renames sync_receive_time to t2, delay_req_send_time to t3
and delay_req_receive_time to t4 (there is "t1" field in ppi yet).

Such naming is what the official documents use everywhere, so it's
better to respect that naming, that everybody in the field is familiar
with. Besides, they are shorter and they can be used unchanged for
pdelay operations (the previous pdelay implementation we inherited
from ptpd, used a separate set of fields that are not really needed).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 691947bb
......@@ -163,7 +163,7 @@ struct pp_instance {
Integer16 foreign_record_i;
Integer16 foreign_record_best;
struct pp_frgn_master frgn_master[PP_NR_FOREIGN_RECORDS];
TimeInternal sync_receive_time;
TimeInternal t2;
UInteger16 recv_sync_sequence_id;
TimeInternal last_rcv_time; /* used to store timestamp retreived from
......@@ -171,8 +171,8 @@ struct pp_instance {
TimeInternal last_snt_time; /* used to store timestamp retreived from
* sent packet */
TimeInternal last_sync_corr_field;
TimeInternal delay_req_send_time;
TimeInternal delay_req_receive_time;
TimeInternal t3;
TimeInternal t4;
Integer8 log_min_delay_req_interval;
UInteger16 sent_seq[__PP_NR_MESSAGES_TYPES]; /* last sent this type */
......
......@@ -134,7 +134,7 @@ static int wr_handle_followup(struct pp_instance *ppi,
precise_orig_timestamp->phase = 0;
wr_servo_got_sync(ppi, precise_orig_timestamp,
&ppi->sync_receive_time);
&ppi->t2);
/* TODO Check: generates instability (Tx timestamp invalid) */
/* return msg_issue_delay_req(ppi); */
......
......@@ -232,9 +232,9 @@ int wr_servo_got_delay(struct pp_instance *ppi, Integer32 cf)
struct wr_servo_state_t *s =
&((struct wr_data_t *)ppi->ext_data)->servo_state;
s->t3 = ppi->delay_req_send_time;
s->t3 = ppi->t3;
/* s->t3.phase = 0; */
s->t4 = timeint_to_wr(ppi->delay_req_receive_time);
s->t4 = timeint_to_wr(ppi->t4);
s->t4.correct = 1; /* clock->delay_req_receive_time.correct; */
s->t4.phase = (int64_t) cf * 1000LL / 65536LL;
......
......@@ -135,7 +135,6 @@ int st_com_slave_handle_announce(struct pp_instance *ppi, unsigned char *buf,
int st_com_slave_handle_sync(struct pp_instance *ppi, unsigned char *buf,
int len)
{
TimeInternal *time;
TimeInternal origin_tstamp;
TimeInternal correction_field;
MsgHeader *hdr = &ppi->received_ptp_header;
......@@ -144,10 +143,8 @@ int st_com_slave_handle_sync(struct pp_instance *ppi, unsigned char *buf,
if (len < PP_SYNC_LENGTH)
return -1;
time = &ppi->last_rcv_time;
if (ppi->is_from_cur_par) {
ppi->sync_receive_time = *time;
ppi->t2 = ppi->last_rcv_time;
if ((hdr->flagField[0] & PP_TWO_STEP_FLAG) != 0) {
ppi->waiting_for_follow = TRUE;
......@@ -173,7 +170,7 @@ int st_com_slave_handle_sync(struct pp_instance *ppi, unsigned char *buf,
to_TimeInternal(&origin_tstamp,
&sync.originTimestamp);
pp_update_offset(ppi, &origin_tstamp,
&ppi->sync_receive_time,
&ppi->t2,
&correction_field);
pp_update_clock(ppi);
}
......@@ -234,7 +231,7 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
return ret;
pp_update_offset(ppi, &precise_orig_timestamp,
&ppi->sync_receive_time,
&ppi->t2,
&correction_field);
pp_update_clock(ppi);
......
......@@ -28,8 +28,7 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
struct pp_owd_fltr *owd_fltr = &SRV(ppi)->owd_fltr;
/* calc 'slave to master' delay */
sub_TimeInternal(&s_to_m_dly, &ppi->delay_req_receive_time,
&ppi->delay_req_send_time);
sub_TimeInternal(&s_to_m_dly, &ppi->t4, &ppi->t3);
if (OPTS(ppi)->max_dly) { /* If max_delay is 0 then it's OFF */
pp_diag(ppi, servo, 1, "%s aborted, delay "
......@@ -53,9 +52,7 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
/* calc 'slave to_master' delay (master to slave delay is
* already computed in pp_update_offset)
*/
sub_TimeInternal(&SRV(ppi)->delay_sm,
&ppi->delay_req_receive_time,
&ppi->delay_req_send_time);
sub_TimeInternal(&SRV(ppi)->delay_sm, &ppi->t4, &ppi->t3);
/* update 'one_way_delay' */
add_TimeInternal(&DSCUR(ppi)->meanPathDelay,
......
......@@ -69,8 +69,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
resp.requestingPortIdentity.portNumber)
&& ppi->is_from_cur_par) {
to_TimeInternal(&ppi->delay_req_receive_time,
&resp.receiveTimestamp);
to_TimeInternal(&ppi->t4, &resp.receiveTimestamp);
int64_to_TimeInternal(
hdr->correctionfield,
......@@ -113,11 +112,11 @@ out:
if (pp_timeout_z(ppi, PP_TO_DELAYREQ)) {
e = msg_issue_delay_req(ppi);
ppi->delay_req_send_time = ppi->last_snt_time;
ppi->t3 = ppi->last_snt_time;
/* Add latency */
add_TimeInternal(&ppi->delay_req_send_time,
&ppi->delay_req_send_time,
add_TimeInternal(&ppi->t3,
&ppi->t3,
&OPTS(ppi)->outbound_latency);
}
......
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