Add a command line option to select the peer delay mechanism.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
a8a5409b04
commit
b35a45d1a4
2
clock.c
2
clock.c
|
@ -236,7 +236,7 @@ struct clock *clock_create(char *phc, struct interface *iface, int count,
|
|||
|
||||
for (i = 0; i < count; i++) {
|
||||
c->port[i] = port_open(pod, iface[i].name, iface[i].transport,
|
||||
iface[i].timestamping, 1+i, DM_E2E, c);
|
||||
iface[i].timestamping, 1+i, iface[i].dm, c);
|
||||
if (!c->port[i]) {
|
||||
pr_err("failed to open port %s", iface[i].name);
|
||||
return NULL;
|
||||
|
|
2
clock.h
2
clock.h
|
@ -20,6 +20,7 @@
|
|||
#ifndef HAVE_CLOCK_H
|
||||
#define HAVE_CLOCK_H
|
||||
|
||||
#include "dm.h"
|
||||
#include "ds.h"
|
||||
#include "servo.h"
|
||||
#include "tmv.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
/** Defines a network interface, with PTP options. */
|
||||
struct interface {
|
||||
char *name;
|
||||
enum delay_mechanism dm;
|
||||
enum transport_type transport;
|
||||
enum timestamp_type timestamping;
|
||||
};
|
||||
|
|
19
ptp4l.c
19
ptp4l.c
|
@ -57,7 +57,11 @@ static void usage(char *progname)
|
|||
{
|
||||
fprintf(stderr,
|
||||
"\nusage: %s [options]\n\n"
|
||||
" Network Transport\n\n"
|
||||
" Delay Mechanism (per interface)\n\n"
|
||||
" -A Auto, starting with E2E\n"
|
||||
" -E E2E, delay request-response (default)\n"
|
||||
" -P P2P, peer delay mechanism\n\n"
|
||||
" Network Transport (per interface)\n\n"
|
||||
" -2 IEEE 802.3\n"
|
||||
" -4 UDP IPV4 (default)\n"
|
||||
" -6 UDP IPV6\n\n"
|
||||
|
@ -85,6 +89,7 @@ int main(int argc, char *argv[])
|
|||
char *config = NULL, *phc = DEFAULT_PHC, *progname;
|
||||
int c, i, nports = 0, slaveonly = 0;
|
||||
struct interface iface[MAX_PORTS];
|
||||
enum delay_mechanism dm = DM_E2E;
|
||||
enum transport_type transport = TRANS_UDP_IPV4;
|
||||
enum timestamp_type timestamping = TS_HARDWARE;
|
||||
struct clock *clock;
|
||||
|
@ -92,7 +97,7 @@ int main(int argc, char *argv[])
|
|||
/* Process the command line arguments. */
|
||||
progname = strrchr(argv[0], '/');
|
||||
progname = progname ? 1+progname : argv[0];
|
||||
while (EOF != (c = getopt(argc, argv, "246f:hi:l:mp:qrsvz"))) {
|
||||
while (EOF != (c = getopt(argc, argv, "246AEf:hi:l:mPp:qrsvz"))) {
|
||||
switch (c) {
|
||||
case '2':
|
||||
transport = TRANS_IEEE_802_3;
|
||||
|
@ -103,12 +108,19 @@ int main(int argc, char *argv[])
|
|||
case '6':
|
||||
transport = TRANS_UDP_IPV6;
|
||||
break;
|
||||
case 'A':
|
||||
dm = DM_AUTO;
|
||||
break;
|
||||
case 'E':
|
||||
dm = DM_E2E;
|
||||
break;
|
||||
case 'f':
|
||||
config = optarg;
|
||||
break;
|
||||
case 'i':
|
||||
if (nports < MAX_PORTS) {
|
||||
iface[nports].name = optarg;
|
||||
iface[nports].dm = dm;
|
||||
iface[nports].transport = transport;
|
||||
nports++;
|
||||
} else {
|
||||
|
@ -122,6 +134,9 @@ int main(int argc, char *argv[])
|
|||
case 'm':
|
||||
slaveonly = 1;
|
||||
break;
|
||||
case 'P':
|
||||
dm = DM_P2P;
|
||||
break;
|
||||
case 'p':
|
||||
phc = optarg;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue