From 888afcdbae756e0a1bc5bfcbe3089a5f37e69d4e Mon Sep 17 00:00:00 2001 From: Vedang Patel Date: Thu, 28 Mar 2019 20:32:27 -0700 Subject: [PATCH] port: Add logPdelayReqInterval. It will be used to store the current value of Pdelay Request Interval. It will be represented as power of two in seconds. Signed-off-by: Vedang Patel --- port.c | 7 ++++--- port_private.h | 1 + unicast_client.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/port.c b/port.c index b8ae77e..d86900d 100644 --- a/port.c +++ b/port.c @@ -1025,7 +1025,7 @@ static void port_nrate_calculate(struct port *p, tmv_t origin, tmv_t ingress) static void port_nrate_initialize(struct port *p) { - int shift = p->freq_est_interval - p->logMinPdelayReqInterval; + int shift = p->freq_est_interval - p->logPdelayReqInterval; if (shift < 0) shift = 0; @@ -1058,7 +1058,7 @@ int port_set_delay_tmo(struct port *p) { if (p->delayMechanism == DM_P2P) { return set_tmo_log(p->fda.fd[FD_DELAY_TIMER], 1, - p->logMinPdelayReqInterval); + p->logPdelayReqInterval); } else { return set_tmo_random(p->fda.fd[FD_DELAY_TIMER], 0, 2, p->logMinDelayReqInterval); @@ -1254,7 +1254,7 @@ static int port_pdelay_request(struct port *p) msg->header.sequenceId = p->seqnum.delayreq++; msg->header.control = CTL_OTHER; msg->header.logMessageInterval = port_is_ieee8021as(p) ? - p->logMinPdelayReqInterval : 0x7f; + p->logPdelayReqInterval : 0x7f; if (unicast_client_enabled(p) && p->unicast_master_table->peer_name) { msg->address = p->unicast_master_table->peer_addr.address; @@ -1612,6 +1612,7 @@ int port_initialize(struct port *p) p->localPriority = config_get_int(cfg, p->name, "G.8275.portDS.localPriority"); p->logSyncInterval = config_get_int(cfg, p->name, "logSyncInterval"); p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval"); + p->logPdelayReqInterval = p->logMinPdelayReqInterval; p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay"); diff --git a/port_private.h b/port_private.h index 1bc1c3f..37dc4b3 100644 --- a/port_private.h +++ b/port_private.h @@ -116,6 +116,7 @@ struct port { Integer8 logSyncInterval; Enumeration8 delayMechanism; Integer8 logMinPdelayReqInterval; + Integer8 logPdelayReqInterval; UInteger32 neighborPropDelayThresh; int follow_up_info; int freq_est_interval; diff --git a/unicast_client.c b/unicast_client.c index e997672..6495d6f 100644 --- a/unicast_client.c +++ b/unicast_client.c @@ -133,7 +133,7 @@ static int unicast_client_peer_renew(struct port *p) if (!msg) { return -1; } - err = attach_request(msg, p->logMinPdelayReqInterval, PDELAY_RESP, + err = attach_request(msg, p->logPdelayReqInterval, PDELAY_RESP, p->unicast_req_duration); if (err) { goto out; @@ -392,7 +392,7 @@ void unicast_client_grant(struct port *p, struct ptp_message *m, unicast_client_set_renewal(p, &p->unicast_master_table->peer_addr, g->durationField); - p->logMinPdelayReqInterval = g->logInterMessagePeriod; + p->logPdelayReqInterval = g->logInterMessagePeriod; return; default: break;