Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 clock.c  |  3 ++-
 config.c | 35 ++++++++++-------------------------
 config.h |  1 -
 ds.h     |  1 -
 port.c   |  2 +-
 ptp4l.c  |  1 -
 6 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/clock.c b/clock.c
index d0298f4..a923915 100644
--- a/clock.c
+++ b/clock.c
@@ -879,7 +879,8 @@ struct clock *clock_create(struct config *config, int 
phc_index,
        }
        c->servo_state = SERVO_UNLOCKED;
        c->servo_type = servo;
-       c->tsproc = tsproc_create(dds->tsproc_mode, dds->delay_filter,
+       c->tsproc = tsproc_create(config_get_int(config, NULL, "tsproc_mode"),
+                                 dds->delay_filter,
                                  config_get_int(config, NULL, 
"delay_filter_length"));
        if (!c->tsproc) {
                pr_err("Failed to create time stamp processor");
diff --git a/config.c b/config.c
index 3fce7d2..4701e92 100644
--- a/config.c
+++ b/config.c
@@ -124,6 +124,14 @@ static struct config_enum nw_trans_enu[] = {
        { NULL, 0 },
 };
 
+static struct config_enum tsproc_enu[] = {
+       { "filter",        TSPROC_FILTER        },
+       { "raw",           TSPROC_RAW           },
+       { "filter_weight", TSPROC_FILTER_WEIGHT },
+       { "raw_weight",    TSPROC_RAW_WEIGHT    },
+       { NULL, 0 },
+};
+
 struct config_item config_tab[] = {
        PORT_ITEM_INT("announceReceiptTimeout", 3, 2, UINT8_MAX),
        GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
@@ -174,6 +182,7 @@ struct config_item config_tab[] = {
        PORT_ITEM_INT("syncReceiptTimeout", 0, 0, UINT8_MAX),
        GLOB_ITEM_INT("timeSource", INTERNAL_OSCILLATOR, 0x10, 0xfe),
        PORT_ITEM_INT("transportSpecific", 0, 0, 0x0F),
+       PORT_ITEM_ENU("tsproc_mode", TSPROC_FILTER, tsproc_enu),
        GLOB_ITEM_INT("twoStepFlag", 1, 0, 1),
        GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX),
        PORT_ITEM_INT("udp_ttl", 1, 1, 255),
@@ -375,19 +384,7 @@ static enum parser_result parse_port_setting(struct config 
*cfg,
        if (r != NOT_PARSED)
                return r;
 
-       if (!strcmp(option, "tsproc_mode")) {
-               if (!strcasecmp("filter", value))
-                       iface->tsproc_mode = TSPROC_FILTER;
-               else if (!strcasecmp("raw", value))
-                       iface->tsproc_mode = TSPROC_RAW;
-               else if (!strcasecmp("filter_weight", value))
-                       iface->tsproc_mode = TSPROC_FILTER_WEIGHT;
-               else if (!strcasecmp("raw_weight", value))
-                       iface->tsproc_mode = TSPROC_RAW_WEIGHT;
-               else
-                       return BAD_VALUE;
-
-       } else if (!strcmp(option, "delay_filter")) {
+       if (!strcmp(option, "delay_filter")) {
                if (!strcasecmp("moving_average", value))
                        iface->delay_filter = FILTER_MOVING_AVERAGE;
                else if (!strcasecmp("moving_median", value))
@@ -491,18 +488,6 @@ static enum parser_result parse_global_setting(const char 
*option,
                for (i = 0; i < OUI_LEN; i++)
                        cfg->dds.clock_desc.manufacturerIdentity[i] = oui[i];
 
-       } else if (!strcmp(option, "tsproc_mode")) {
-               if (!strcasecmp("filter", value))
-                       cfg->dds.tsproc_mode = TSPROC_FILTER;
-               else if (!strcasecmp("raw", value))
-                       cfg->dds.tsproc_mode = TSPROC_RAW;
-               else if (!strcasecmp("filter_weight", value))
-                       cfg->dds.tsproc_mode = TSPROC_FILTER_WEIGHT;
-               else if (!strcasecmp("raw_weight", value))
-                       cfg->dds.tsproc_mode = TSPROC_RAW_WEIGHT;
-               else
-                       return BAD_VALUE;
-
        } else if (!strcmp(option, "delay_filter")) {
                if (!strcasecmp("moving_average", value))
                        cfg->dds.delay_filter = FILTER_MOVING_AVERAGE;
diff --git a/config.h b/config.h
index e1c24e8..2e60706 100644
--- a/config.h
+++ b/config.h
@@ -36,7 +36,6 @@ struct interface {
        STAILQ_ENTRY(interface) list;
        char name[MAX_IFNAME_SIZE + 1];
        struct sk_ts_info ts_info;
-       enum tsproc_mode tsproc_mode;
        enum filter_type delay_filter;
 };
 
diff --git a/ds.h b/ds.h
index a431616..3a175a9 100644
--- a/ds.h
+++ b/ds.h
@@ -53,7 +53,6 @@ struct clock_description {
 struct default_ds {
        struct defaultDS dds;
        struct clock_description clock_desc;
-       enum tsproc_mode tsproc_mode;
        enum filter_type delay_filter;
 };
 
diff --git a/port.c b/port.c
index 8d48cf8..624a070 100644
--- a/port.c
+++ b/port.c
@@ -2565,7 +2565,7 @@ struct port *port_open(int phc_index,
        p->flt_interval_pertype[FT_UNSPECIFIED].val =
                config_get_int(cfg, p->name, "fault_reset_interval");
 
-       p->tsproc = tsproc_create(interface->tsproc_mode,
+       p->tsproc = tsproc_create(config_get_int(cfg, p->name, "tsproc_mode"),
                                  interface->delay_filter,
                                  config_get_int(cfg, p->name, 
"delay_filter_length"));
        if (!p->tsproc) {
diff --git a/ptp4l.c b/ptp4l.c
index cd81944..2e954d6 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -57,7 +57,6 @@ static struct config cfg_settings = {
                        .userDescription      = { .max_symbols = 128 },
                        .manufacturerIdentity = { 0, 0, 0 },
                },
-               .tsproc_mode = TSPROC_FILTER,
                .delay_filter = FILTER_MOVING_MEDIAN,
        },
 
-- 
2.1.4


------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to