Add transmit support for the transportSpecific field
Add transportSpecific parameter to config file parser Set transportSpecific field in message headers as using the configuration (default to 0) [ RC - reduced this patch to just the addition of the field ] Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com> Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
e29ef34432
commit
9bdf92a7cf
4
config.c
4
config.c
|
@ -81,6 +81,10 @@ static void scan_line(char *s, struct config *cfg)
|
||||||
|
|
||||||
pod->announceReceiptTimeout = u8;
|
pod->announceReceiptTimeout = u8;
|
||||||
|
|
||||||
|
} else if (1 == sscanf(s, " transportSpecific %hhx", &u8)) {
|
||||||
|
|
||||||
|
pod->transportSpecific = u8 << 4;
|
||||||
|
|
||||||
} else if (1 == sscanf(s, " tx_timestamp_retries %u", &val)) {
|
} else if (1 == sscanf(s, " tx_timestamp_retries %u", &val)) {
|
||||||
|
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
|
|
1
ds.h
1
ds.h
|
@ -81,6 +81,7 @@ struct port_defaults {
|
||||||
Integer8 logSyncInterval;
|
Integer8 logSyncInterval;
|
||||||
Integer8 logMinDelayReqInterval;
|
Integer8 logMinDelayReqInterval;
|
||||||
UInteger8 announceReceiptTimeout;
|
UInteger8 announceReceiptTimeout;
|
||||||
|
UInteger8 transportSpecific;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
18
port.c
18
port.c
|
@ -70,6 +70,7 @@ struct port {
|
||||||
TimeInterval peerMeanPathDelay;
|
TimeInterval peerMeanPathDelay;
|
||||||
Integer8 logAnnounceInterval;
|
Integer8 logAnnounceInterval;
|
||||||
UInteger8 announceReceiptTimeout;
|
UInteger8 announceReceiptTimeout;
|
||||||
|
UInteger8 transportSpecific;
|
||||||
Integer8 logSyncInterval;
|
Integer8 logSyncInterval;
|
||||||
Enumeration8 delayMechanism;
|
Enumeration8 delayMechanism;
|
||||||
Integer8 logMinPdelayReqInterval;
|
Integer8 logMinPdelayReqInterval;
|
||||||
|
@ -376,7 +377,7 @@ static int port_pdelay_request(struct port *p)
|
||||||
pdulen = sizeof(struct pdelay_req_msg);
|
pdulen = sizeof(struct pdelay_req_msg);
|
||||||
msg->hwts.type = p->timestamping;
|
msg->hwts.type = p->timestamping;
|
||||||
|
|
||||||
msg->header.tsmt = PDELAY_REQ;
|
msg->header.tsmt = PDELAY_REQ | p->transportSpecific;
|
||||||
msg->header.ver = PTP_VERSION;
|
msg->header.ver = PTP_VERSION;
|
||||||
msg->header.messageLength = pdulen;
|
msg->header.messageLength = pdulen;
|
||||||
msg->header.domainNumber = clock_domain_number(p->clock);
|
msg->header.domainNumber = clock_domain_number(p->clock);
|
||||||
|
@ -423,7 +424,7 @@ static int port_delay_request(struct port *p)
|
||||||
pdulen = sizeof(struct delay_req_msg);
|
pdulen = sizeof(struct delay_req_msg);
|
||||||
msg->hwts.type = p->timestamping;
|
msg->hwts.type = p->timestamping;
|
||||||
|
|
||||||
msg->header.tsmt = DELAY_REQ;
|
msg->header.tsmt = DELAY_REQ | p->transportSpecific;
|
||||||
msg->header.ver = PTP_VERSION;
|
msg->header.ver = PTP_VERSION;
|
||||||
msg->header.messageLength = pdulen;
|
msg->header.messageLength = pdulen;
|
||||||
msg->header.domainNumber = clock_domain_number(p->clock);
|
msg->header.domainNumber = clock_domain_number(p->clock);
|
||||||
|
@ -469,7 +470,7 @@ static int port_tx_announce(struct port *p)
|
||||||
pdulen = sizeof(struct announce_msg);
|
pdulen = sizeof(struct announce_msg);
|
||||||
msg->hwts.type = p->timestamping;
|
msg->hwts.type = p->timestamping;
|
||||||
|
|
||||||
msg->header.tsmt = ANNOUNCE;
|
msg->header.tsmt = ANNOUNCE | p->transportSpecific;
|
||||||
msg->header.ver = PTP_VERSION;
|
msg->header.ver = PTP_VERSION;
|
||||||
msg->header.messageLength = pdulen;
|
msg->header.messageLength = pdulen;
|
||||||
msg->header.domainNumber = clock_domain_number(p->clock);
|
msg->header.domainNumber = clock_domain_number(p->clock);
|
||||||
|
@ -530,7 +531,7 @@ static int port_tx_sync(struct port *p)
|
||||||
pdulen = sizeof(struct sync_msg);
|
pdulen = sizeof(struct sync_msg);
|
||||||
msg->hwts.type = p->timestamping;
|
msg->hwts.type = p->timestamping;
|
||||||
|
|
||||||
msg->header.tsmt = SYNC;
|
msg->header.tsmt = SYNC | p->transportSpecific;
|
||||||
msg->header.ver = PTP_VERSION;
|
msg->header.ver = PTP_VERSION;
|
||||||
msg->header.messageLength = pdulen;
|
msg->header.messageLength = pdulen;
|
||||||
msg->header.domainNumber = clock_domain_number(p->clock);
|
msg->header.domainNumber = clock_domain_number(p->clock);
|
||||||
|
@ -563,7 +564,7 @@ static int port_tx_sync(struct port *p)
|
||||||
pdulen = sizeof(struct follow_up_msg);
|
pdulen = sizeof(struct follow_up_msg);
|
||||||
fup->hwts.type = p->timestamping;
|
fup->hwts.type = p->timestamping;
|
||||||
|
|
||||||
fup->header.tsmt = FOLLOW_UP;
|
fup->header.tsmt = FOLLOW_UP | p->transportSpecific;
|
||||||
fup->header.ver = PTP_VERSION;
|
fup->header.ver = PTP_VERSION;
|
||||||
fup->header.messageLength = pdulen;
|
fup->header.messageLength = pdulen;
|
||||||
fup->header.domainNumber = clock_domain_number(p->clock);
|
fup->header.domainNumber = clock_domain_number(p->clock);
|
||||||
|
@ -657,6 +658,7 @@ static int port_initialize(struct port *p)
|
||||||
p->peerMeanPathDelay = 0;
|
p->peerMeanPathDelay = 0;
|
||||||
p->logAnnounceInterval = p->pod.logAnnounceInterval;
|
p->logAnnounceInterval = p->pod.logAnnounceInterval;
|
||||||
p->announceReceiptTimeout = p->pod.announceReceiptTimeout;
|
p->announceReceiptTimeout = p->pod.announceReceiptTimeout;
|
||||||
|
p->transportSpecific = p->pod.transportSpecific;
|
||||||
p->logSyncInterval = p->pod.logSyncInterval;
|
p->logSyncInterval = p->pod.logSyncInterval;
|
||||||
p->logMinPdelayReqInterval = LOG_MIN_PDELAY_REQ_INTERVAL;
|
p->logMinPdelayReqInterval = LOG_MIN_PDELAY_REQ_INTERVAL;
|
||||||
|
|
||||||
|
@ -786,7 +788,7 @@ static int process_delay_req(struct port *p, struct ptp_message *m)
|
||||||
pdulen = sizeof(struct delay_resp_msg);
|
pdulen = sizeof(struct delay_resp_msg);
|
||||||
msg->hwts.type = p->timestamping;
|
msg->hwts.type = p->timestamping;
|
||||||
|
|
||||||
msg->header.tsmt = DELAY_RESP;
|
msg->header.tsmt = DELAY_RESP | p->transportSpecific;
|
||||||
msg->header.ver = PTP_VERSION;
|
msg->header.ver = PTP_VERSION;
|
||||||
msg->header.messageLength = pdulen;
|
msg->header.messageLength = pdulen;
|
||||||
msg->header.domainNumber = m->header.domainNumber;
|
msg->header.domainNumber = m->header.domainNumber;
|
||||||
|
@ -913,7 +915,7 @@ static int process_pdelay_req(struct port *p, struct ptp_message *m)
|
||||||
rsp_len = sizeof(struct pdelay_resp_msg);
|
rsp_len = sizeof(struct pdelay_resp_msg);
|
||||||
rsp->hwts.type = p->timestamping;
|
rsp->hwts.type = p->timestamping;
|
||||||
|
|
||||||
rsp->header.tsmt = PDELAY_RESP;
|
rsp->header.tsmt = PDELAY_RESP | p->transportSpecific;
|
||||||
rsp->header.ver = PTP_VERSION;
|
rsp->header.ver = PTP_VERSION;
|
||||||
rsp->header.messageLength = rsp_len;
|
rsp->header.messageLength = rsp_len;
|
||||||
rsp->header.domainNumber = m->header.domainNumber;
|
rsp->header.domainNumber = m->header.domainNumber;
|
||||||
|
@ -934,7 +936,7 @@ static int process_pdelay_req(struct port *p, struct ptp_message *m)
|
||||||
fup_len = sizeof(struct pdelay_resp_fup_msg);
|
fup_len = sizeof(struct pdelay_resp_fup_msg);
|
||||||
fup->hwts.type = p->timestamping;
|
fup->hwts.type = p->timestamping;
|
||||||
|
|
||||||
fup->header.tsmt = PDELAY_RESP_FOLLOW_UP;
|
fup->header.tsmt = PDELAY_RESP_FOLLOW_UP | p->transportSpecific;
|
||||||
fup->header.ver = PTP_VERSION;
|
fup->header.ver = PTP_VERSION;
|
||||||
fup->header.messageLength = fup_len;
|
fup->header.messageLength = fup_len;
|
||||||
fup->header.domainNumber = m->header.domainNumber;
|
fup->header.domainNumber = m->header.domainNumber;
|
||||||
|
|
1
ptp4l.c
1
ptp4l.c
|
@ -207,6 +207,7 @@ int main(int argc, char *argv[])
|
||||||
pod.logSyncInterval = 0;
|
pod.logSyncInterval = 0;
|
||||||
pod.logMinDelayReqInterval = 0;
|
pod.logMinDelayReqInterval = 0;
|
||||||
pod.announceReceiptTimeout = 3;
|
pod.announceReceiptTimeout = 3;
|
||||||
|
pod.transportSpecific = 0;
|
||||||
|
|
||||||
if (generate_clock_identity(&ds.clockIdentity, iface[0].name)) {
|
if (generate_clock_identity(&ds.clockIdentity, iface[0].name)) {
|
||||||
fprintf(stderr, "failed to generate a clock identity\n");
|
fprintf(stderr, "failed to generate a clock identity\n");
|
||||||
|
|
Loading…
Reference in New Issue