Commit 386b5117 authored by Alessandro Rubini's avatar Alessandro Rubini

pdelay: share values with delay/response

The timeout for sending a requeste can be shareby by delay/pdelay;
same for logMinDelayReqInterval.

Moreover, I took the chance to remove the third extension-specific
timeout slot (WR only uses 1, keep two of them...).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 7ce1eb1d
......@@ -28,7 +28,6 @@
#define PP_DEFAULT_DELAY_S 6
#define PP_DEFAULT_ANNOUNCE_INTERVAL 1 /* 0 in 802.1AS */
#define PP_DEFAULT_DELAYREQ_INTERVAL 0
#define PP_DEFAULT_PDELAYREQ_INTERVAL 0
#define PP_DEFAULT_SYNC_INTERVAL 0 /* -7 in 802.1AS */
#define PP_DEFAULT_SYNC_RECEIPT_TIMEOUT 3
#define PP_DEFAULT_ANNOUNCE_RECEIPT_TIMEOUT 20 /* 3 by default */
......@@ -54,15 +53,13 @@
/* We use an array of timeouts, with these indexes */
enum pp_timeouts {
PP_TO_DELAYREQ = 0,
PP_TO_PDELAYREQ,
PP_TO_SYNC,
PP_TO_ANN_RECEIPT,
PP_TO_ANN_INTERVAL,
PP_TO_FAULTY,
/* A few timeouts for the protocol extension */
/* Two timeouts for the protocol extension */
PP_TO_EXT_0,
PP_TO_EXT_1,
PP_TO_EXT_2,
__PP_TO_ARRAY_SIZE,
};
......
......@@ -255,13 +255,12 @@ typedef struct DSPort { /* page 72 */
PortIdentity portIdentity;
/* Dynamic */
/* Enumeration8 portState; -- not used */
Integer8 logMinDelayReqInterval; /* note: never changed */
Integer8 logMinDelayReqInterval; /* -- same as pdelay one */
/* TimeInternal peerMeanPathDelay; -- not used */
/* Configurable */
Integer8 logAnnounceInterval;
UInteger8 announceReceiptTimeout;
Integer8 logSyncInterval;
Integer8 logMinPDelayReqInterval;
/* Enumeration8 delayMechanism; -- not used */
UInteger4 versionNumber;
......
......@@ -42,7 +42,6 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
/* 1-based port number = index of this ppi in the global array */
port->portIdentity.portNumber = 1 + ppi - ppi->glbs->pp_instances;
port->logMinDelayReqInterval = PP_DEFAULT_DELAYREQ_INTERVAL;
port->logMinPDelayReqInterval = PP_DEFAULT_PDELAYREQ_INTERVAL;
port->logAnnounceInterval = opt->announce_intvl;
port->announceReceiptTimeout = PP_DEFAULT_ANNOUNCE_RECEIPT_TIMEOUT;
port->logSyncInterval = opt->sync_intvl;
......
......@@ -27,8 +27,8 @@ int pp_pclock(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->flags &= ~PPI_FLAGS_WAITING;
pp_timeout_restart_annrec(ppi);
pp_timeout_rand(ppi, PP_TO_PDELAYREQ,
DSPOR(ppi)->logMinPDelayReqInterval);
pp_timeout_rand(ppi, PP_TO_DELAYREQ,
DSPOR(ppi)->logMinDelayReqInterval);
}
if (plen == 0)
......@@ -110,14 +110,14 @@ out:
if (e == 0)
e = st_com_execute_slave(ppi);
if (pp_timeout_z(ppi, PP_TO_PDELAYREQ)) {
if (pp_timeout_z(ppi, PP_TO_DELAYREQ)) {
e = msg_issue_pdelay_req(ppi);
ppi->t3 = ppi->last_snt_time;
/* Restart the timeout for next time */
pp_timeout_rand(ppi, PP_TO_PDELAYREQ,
DSPOR(ppi)->logMinPDelayReqInterval);
pp_timeout_rand(ppi, PP_TO_DELAYREQ,
DSPOR(ppi)->logMinDelayReqInterval);
}
if (e) {
......@@ -128,14 +128,14 @@ out:
/* Leaving this state */
if (ppi->next_state != ppi->state) {
pp_timeout_clr(ppi, PP_TO_ANN_RECEIPT);
pp_timeout_clr(ppi, PP_TO_PDELAYREQ);
pp_timeout_clr(ppi, PP_TO_DELAYREQ);
pp_servo_init(ppi);
}
d1 = d2 = pp_ms_to_timeout(ppi, PP_TO_ANN_RECEIPT);
if (ppi->timeouts[PP_TO_PDELAYREQ])
d2 = pp_ms_to_timeout(ppi, PP_TO_PDELAYREQ);
if (ppi->timeouts[PP_TO_DELAYREQ])
d2 = pp_ms_to_timeout(ppi, PP_TO_DELAYREQ);
ppi->next_delay = d1 < d2 ? d1 : d2;
......
......@@ -16,7 +16,6 @@ static char *timeout_names[__PP_TO_ARRAY_SIZE] __attribute__((used)) = {
N(PP_TO_FAULTY),
N(PP_TO_EXT_0),
N(PP_TO_EXT_1),
N(PP_TO_EXT_2),
};
/*
......
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