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 <vedang.patel@intel.com>
master
Vedang Patel 2019-03-28 20:32:27 -07:00 committed by Richard Cochran
parent 43085ab741
commit 888afcdbae
3 changed files with 7 additions and 5 deletions

7
port.c
View File

@ -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) 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) if (shift < 0)
shift = 0; shift = 0;
@ -1058,7 +1058,7 @@ int port_set_delay_tmo(struct port *p)
{ {
if (p->delayMechanism == DM_P2P) { if (p->delayMechanism == DM_P2P) {
return set_tmo_log(p->fda.fd[FD_DELAY_TIMER], 1, return set_tmo_log(p->fda.fd[FD_DELAY_TIMER], 1,
p->logMinPdelayReqInterval); p->logPdelayReqInterval);
} else { } else {
return set_tmo_random(p->fda.fd[FD_DELAY_TIMER], 0, 2, return set_tmo_random(p->fda.fd[FD_DELAY_TIMER], 0, 2,
p->logMinDelayReqInterval); p->logMinDelayReqInterval);
@ -1254,7 +1254,7 @@ static int port_pdelay_request(struct port *p)
msg->header.sequenceId = p->seqnum.delayreq++; msg->header.sequenceId = p->seqnum.delayreq++;
msg->header.control = CTL_OTHER; msg->header.control = CTL_OTHER;
msg->header.logMessageInterval = port_is_ieee8021as(p) ? msg->header.logMessageInterval = port_is_ieee8021as(p) ?
p->logMinPdelayReqInterval : 0x7f; p->logPdelayReqInterval : 0x7f;
if (unicast_client_enabled(p) && p->unicast_master_table->peer_name) { if (unicast_client_enabled(p) && p->unicast_master_table->peer_name) {
msg->address = p->unicast_master_table->peer_addr.address; 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->localPriority = config_get_int(cfg, p->name, "G.8275.portDS.localPriority");
p->logSyncInterval = config_get_int(cfg, p->name, "logSyncInterval"); p->logSyncInterval = config_get_int(cfg, p->name, "logSyncInterval");
p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval"); p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval");
p->logPdelayReqInterval = p->logMinPdelayReqInterval;
p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh");
p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay"); p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay");

View File

@ -116,6 +116,7 @@ struct port {
Integer8 logSyncInterval; Integer8 logSyncInterval;
Enumeration8 delayMechanism; Enumeration8 delayMechanism;
Integer8 logMinPdelayReqInterval; Integer8 logMinPdelayReqInterval;
Integer8 logPdelayReqInterval;
UInteger32 neighborPropDelayThresh; UInteger32 neighborPropDelayThresh;
int follow_up_info; int follow_up_info;
int freq_est_interval; int freq_est_interval;

View File

@ -133,7 +133,7 @@ static int unicast_client_peer_renew(struct port *p)
if (!msg) { if (!msg) {
return -1; return -1;
} }
err = attach_request(msg, p->logMinPdelayReqInterval, PDELAY_RESP, err = attach_request(msg, p->logPdelayReqInterval, PDELAY_RESP,
p->unicast_req_duration); p->unicast_req_duration);
if (err) { if (err) {
goto out; goto out;
@ -392,7 +392,7 @@ void unicast_client_grant(struct port *p, struct ptp_message *m,
unicast_client_set_renewal(p, unicast_client_set_renewal(p,
&p->unicast_master_table->peer_addr, &p->unicast_master_table->peer_addr,
g->durationField); g->durationField);
p->logMinPdelayReqInterval = g->logInterMessagePeriod; p->logPdelayReqInterval = g->logInterMessagePeriod;
return; return;
default: default:
break; break;