> -----Original Message-----
> From: Petr Kulhavy [mailto:br...@jikos.cz]
> Sent: Monday, January 29, 2018 7:49 AM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH] phc2sys: add transport specific
> 
> Add option -T to specify transport specific field other than 0.
> 
> Signed-off-by: Petr Kulhavy <br...@jikos.cz>
> ---

I think we prefer to add configuration options for stuff that isn't used as 
often, but I can't recall if phc2sys has config option support yet.

Thanks,
Jake

>  phc2sys.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/phc2sys.c b/phc2sys.c
> index 5c54055..dc5a71a 100644
> --- a/phc2sys.c
> +++ b/phc2sys.c
> @@ -871,13 +871,13 @@ static void send_subscription(struct node *node)
>       pmc_send_set_action(node->pmc, TLV_SUBSCRIBE_EVENTS_NP, &sen,
> sizeof(sen));
>  }
> 
> -static int init_pmc(struct config *cfg, struct node *node, int domain_number)
> +static int init_pmc(struct config *cfg, struct node *node, int 
> domain_number, int
> transport_specific)
>  {
>       char uds_local[MAX_IFNAME_SIZE + 1];
> 
>       snprintf(uds_local, sizeof(uds_local), "/var/run/phc2sys.%d",
>                getpid());
> -     node->pmc = pmc_create(cfg, TRANS_UDS, uds_local, 0,
> domain_number, 0, 1);
> +     node->pmc = pmc_create(cfg, TRANS_UDS, uds_local, 0,
> domain_number, transport_specific, 1);
>       if (!node->pmc) {
>               pr_err("failed to create pmc");
>               return -1;
> @@ -1295,6 +1295,7 @@ static void usage(char *progname)
>               " -N [num]       number of master clock readings per update 
> (5)\n"
>               " -L [limit]     sanity frequency limit in ppb (200000000)\n"
>               " -M [num]       NTP SHM segment number (0)\n"
> +             " -T [hex]       transport specific field (default 0x0)\n"
>               " -u [num]       number of clock updates in summary stats (0)\n"
>               " -n [num]       domain number (0)\n"
>               " -x             apply leap seconds by servo instead of 
> kernel\n"
> @@ -1319,6 +1320,7 @@ int main(int argc, char *argv[])
>       int c, domain_number = 0, pps_fd = -1;
>       int r = -1, wait_sync = 0;
>       int print_level = LOG_INFO, use_syslog = 1, verbose = 0;
> +     int transport_specific = 0;
>       int ntpshm_segment;
>       double phc_rate, tmp;
>       struct node node = {
> @@ -1343,7 +1345,7 @@ int main(int argc, char *argv[])
>       progname = strrchr(argv[0], '/');
>       progname = progname ? 1+progname : argv[0];
>       while (EOF != (c = getopt(argc, argv,
> -
> "arc:d:s:E:P:I:S:F:R:N:O:L:M:i:u:wn:xz:l:t:mqvh"))) {
> +
> "arc:d:s:E:P:I:S:F:R:N:O:L:M:T:i:u:wn:xz:l:t:mqvh"))) {
>               switch (c) {
>               case 'a':
>                       autocfg = 1;
> @@ -1425,6 +1427,10 @@ int main(int argc, char *argv[])
>                           config_set_int(cfg, "ntpshm_segment",
> ntpshm_segment))
>                               goto end;
>                       break;
> +             case 'T':
> +                     if (1 == sscanf(optarg, "%x", &c))
> +                             transport_specific = c << 4;
> +                     break;
>               case 'u':
>                       if (get_arg_val_ui(c, optarg, &node.stats_max_count,
>                                         0, UINT_MAX))
> @@ -1506,7 +1512,7 @@ int main(int argc, char *argv[])
>       print_set_level(print_level);
> 
>       if (autocfg) {
> -             if (init_pmc(cfg, &node, domain_number))
> +             if (init_pmc(cfg, &node, domain_number, transport_specific))
>                       goto end;
>               if (auto_init_ports(&node, rt) < 0)
>                       goto end;
> @@ -1542,7 +1548,7 @@ int main(int argc, char *argv[])
>       r = -1;
> 
>       if (wait_sync) {
> -             if (init_pmc(cfg, &node, domain_number))
> +             if (init_pmc(cfg, &node, domain_number, transport_specific))
>                       goto end;
> 
>               while (is_running()) {
> --
> 2.7.4
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to