Make the number of transmit time stamp retries configurable.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
da69203517
commit
3ff62648fa
5
config.c
5
config.c
|
@ -79,6 +79,11 @@ static void scan_line(char *s, struct config *cfg)
|
||||||
} else if (1 == sscanf(s, " announceReceiptTimeout %hhu", &u8)) {
|
} else if (1 == sscanf(s, " announceReceiptTimeout %hhu", &u8)) {
|
||||||
|
|
||||||
pod->announceReceiptTimeout = u8;
|
pod->announceReceiptTimeout = u8;
|
||||||
|
|
||||||
|
} else if (1 == sscanf(s, " tx_timestamp_retries %u", &val)) {
|
||||||
|
|
||||||
|
if (val > 0)
|
||||||
|
*cfg->tx_timestamp_retries = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
config.h
1
config.h
|
@ -25,6 +25,7 @@
|
||||||
struct config {
|
struct config {
|
||||||
struct defaultDS *dds;
|
struct defaultDS *dds;
|
||||||
struct port_defaults *pod;
|
struct port_defaults *pod;
|
||||||
|
int *tx_timestamp_retries;
|
||||||
};
|
};
|
||||||
|
|
||||||
int config_read(char *name, struct config *cfg);
|
int config_read(char *name, struct config *cfg);
|
||||||
|
|
|
@ -16,3 +16,7 @@ logAnnounceInterval 1
|
||||||
logSyncInterval 0
|
logSyncInterval 0
|
||||||
logMinDelayReqInterval 0
|
logMinDelayReqInterval 0
|
||||||
announceReceiptTimeout 3
|
announceReceiptTimeout 3
|
||||||
|
#
|
||||||
|
# Run time options
|
||||||
|
#
|
||||||
|
tx_timestamp_retries 2
|
||||||
|
|
3
ptp4l.c
3
ptp4l.c
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
#define DEFAULT_PHC "/dev/ptp0"
|
#define DEFAULT_PHC "/dev/ptp0"
|
||||||
|
|
||||||
|
int sk_tx_retries = 2; /*see sk.c*/
|
||||||
|
|
||||||
static int running = 1;
|
static int running = 1;
|
||||||
static struct defaultDS ds;
|
static struct defaultDS ds;
|
||||||
static struct port_defaults pod;
|
static struct port_defaults pod;
|
||||||
|
@ -178,6 +180,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
cfg_settings.dds = &ds;
|
cfg_settings.dds = &ds;
|
||||||
cfg_settings.pod = &pod;
|
cfg_settings.pod = &pod;
|
||||||
|
cfg_settings.tx_timestamp_retries = &sk_tx_retries;
|
||||||
|
|
||||||
if (config && config_read(config, &cfg_settings)) {
|
if (config && config_read(config, &cfg_settings)) {
|
||||||
fprintf(stderr, "failed to read configuration file\n");
|
fprintf(stderr, "failed to read configuration file\n");
|
||||||
|
|
2
sk.c
2
sk.c
|
@ -126,7 +126,7 @@ int sk_receive(int fd, void *buf, int buflen,
|
||||||
msg.msg_control = control;
|
msg.msg_control = control;
|
||||||
msg.msg_controllen = sizeof(control);
|
msg.msg_controllen = sizeof(control);
|
||||||
|
|
||||||
try_again = flags == MSG_ERRQUEUE ? 2 : 1;
|
try_again = flags == MSG_ERRQUEUE ? sk_tx_retries : 1;
|
||||||
|
|
||||||
for ( ; try_again; try_again--) {
|
for ( ; try_again; try_again--) {
|
||||||
cnt = recvmsg(fd, &msg, flags);
|
cnt = recvmsg(fd, &msg, flags);
|
||||||
|
|
6
sk.h
6
sk.h
|
@ -60,4 +60,10 @@ int sk_receive(int fd, void *buf, int buflen,
|
||||||
*/
|
*/
|
||||||
int sk_timestamping_init(int fd, char *device, enum timestamp_type type);
|
int sk_timestamping_init(int fd, char *device, enum timestamp_type type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limits the number of RECVMSG(2) calls when attempting to obtain a
|
||||||
|
* transmit time stamp on an event message.
|
||||||
|
*/
|
||||||
|
extern int sk_tx_retries;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue