In support of the NSM protocol, the pmc code will want to compute the
measured offset from a set of four time stamps from an E2E message
exchange.  This patch adds the processor in anticipation of the NSM code.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 makefile     | 11 ++++++-----
 pmc_common.c | 10 ++++++++++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/makefile b/makefile
index f898336..92fad2b 100644
--- a/makefile
+++ b/makefile
@@ -46,12 +46,13 @@ all: $(PRG)
 
 ptp4l: $(OBJ)
 
-pmc: config.o hash.o msg.o pmc.o pmc_common.o print.o raw.o sk.o tlv.o \
- transport.o udp.o udp6.o uds.o util.o version.o
+pmc: config.o filter.o hash.o mave.o mmedian.o msg.o pmc.o pmc_common.o 
print.o \
+ raw.o sk.o tlv.o transport.o tsproc.o udp.o udp6.o uds.o util.o version.o
 
-phc2sys: clockadj.o clockcheck.o config.o hash.o linreg.o msg.o ntpshm.o \
- nullf.o phc.o phc2sys.o pi.o pmc_common.o print.o raw.o servo.o sk.o stats.o \
- sysoff.o tlv.o transport.o udp.o udp6.o uds.o util.o version.o
+phc2sys: clockadj.o clockcheck.o config.o filter.o hash.o linreg.o mave.o \
+ mmedian.o msg.o ntpshm.o nullf.o phc.o phc2sys.o pi.o pmc_common.o print.o \
+ raw.o servo.o sk.o stats.o sysoff.o tlv.o transport.o tsproc.o udp.o udp6.o \
+ uds.o util.o version.o
 
 hwstamp_ctl: hwstamp_ctl.o version.o
 
diff --git a/pmc_common.c b/pmc_common.c
index 8c4f31f..da25c21 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -58,6 +58,7 @@ struct pmc {
 
        struct transport *transport;
        struct fdarray fdarray;
+       struct tsproc *tsproc;
        int zero_length_gets;
 };
 
@@ -73,6 +74,12 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
        if (!pmc)
                return NULL;
 
+       pmc->tsproc = tsproc_create(TSPROC_RAW, FILTER_MOVING_AVERAGE, 10);
+       if (!pmc->tsproc) {
+               pr_err("Failed to create time stamp processor");
+               goto failed;
+       }
+
        if (transport_type != TRANS_UDS &&
            generate_clock_identity(&pmc->port_identity.clockIdentity,
                                    iface_name)) {
@@ -103,6 +110,8 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
        return pmc;
 
 failed:
+       if (pmc->tsproc)
+               tsproc_destroy(pmc->tsproc);
        if (pmc->transport)
                transport_destroy(pmc->transport);
        free(pmc);
@@ -111,6 +120,7 @@ failed:
 
 void pmc_destroy(struct pmc *pmc)
 {
+       tsproc_destroy(pmc->tsproc);
        transport_close(pmc->transport, &pmc->fdarray);
        transport_destroy(pmc->transport);
        free(pmc);
-- 
2.11.0


------------------------------------------------------------------------------
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