On Wed, 24 Aug 2022 at 12:37, SyncMonk Technologies <servi...@syncmonk.net>
wrote:

> - adding sync receipt timeout, delay response timeout and signal fail
>   support to portDS as per G.8275.2.
> - This also sets the signal fail condition for timeout.
>

The management interface follows the IEEE standard.
Please follow the standard, and do not add values that break the standard.


> Signed-off-by: Greg Armstrong <greg.armstrong...@renesas.com>
> Signed-off-by: Leon Goldin <leon.goldin...@renesas.com>
> Signed-off-by: Devasish Dey <devasish....@syncmonk.net>
> Signed-off-by: Vipin Sharma <vipin.sha...@syncmonk.net>
> ---
>  ds.h           |  9 +++++++++
>  pmc.c          |  9 +++++++--
>  port.c         | 16 +++++++++++++++-
>  port_private.h |  1 +
>  4 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/ds.h b/ds.h
> index dff6d5e..5136bb2 100644
> --- a/ds.h
> +++ b/ds.h
> @@ -95,6 +95,11 @@ struct timePropertiesDS {
>         Enumeration8 timeSource;
>  } PACKED;
>
> +
>
Please add explanation on these new macro
What are they counting, and what is PDS and PTSF

> +#define PDS_PTSF_LOSS_SYNC        (1<<0)
> +#define PDS_PTSF_UNUSABLE         (1<<1)
> +#define PDS_PTSF_LOSS_DELAY_RESP  (1<<2)
> +
>  struct portDS {
>         struct PortIdentity portIdentity;
>         Enumeration8        portState;
> @@ -106,6 +111,10 @@ struct portDS {
>         Enumeration8        delayMechanism;
>         Integer8            logMinPdelayReqInterval;
>         UInteger8           versionNumber;
>

This structure follows the standard management TLV PORT_DATA_SET,
It follows the standard. You can not add new values here!

> +       UInteger8           localPriority;
> +       UInteger8           signalFail;
> +       UInteger8           syncReceiptTimeout;
> +       UInteger8           delayRespReceiptTimeout;
>  } PACKED;
>
>  #define FRI_ASAP (-128)
> diff --git a/pmc.c b/pmc.c
> index e218ca4..cdc76c8 100644
> --- a/pmc.c
> +++ b/pmc.c
> @@ -438,16 +438,21 @@ static void pmc_show(struct ptp_message *msg, FILE
> *fp)
>                         IFMT "peerMeanPathDelay       %" PRId64
>                         IFMT "logAnnounceInterval     %hhd"
>                         IFMT "announceReceiptTimeout  %hhu"
> +                       IFMT "syncReceiptTimeout      %hhu"
> +                       IFMT "delayRespReceiptTimeout %hhu"
>                         IFMT "logSyncInterval         %hhd"
>                         IFMT "delayMechanism          %hhu"
>                         IFMT "logMinPdelayReqInterval %hhd"
> -                       IFMT "versionNumber           %u",
> +                       IFMT "versionNumber           %u"
> +                       IFMT "signalFail              %d",
>                         pid2str(&p->portIdentity), ps_str[p->portState],
>                         p->logMinDelayReqInterval, p->peerMeanPathDelay >>
> 16,
>                         p->logAnnounceInterval, p->announceReceiptTimeout,
>

This structure follows the standard,
You can not add new values here!

> +                       p->syncReceiptTimeout, p->delayRespReceiptTimeout,
>                         p->logSyncInterval, p->delayMechanism,
>                         p->logMinPdelayReqInterval,
> -                       p->versionNumber & MAJOR_VERSION_MASK);
> +                       p->versionNumber & MAJOR_VERSION_MASK,
> +                       p->signalFail ? 1 : 0);
>                 break;
>         case MID_PORT_DATA_SET_NP:
>                 pnp = (struct port_ds_np *) mgt->data;
> diff --git a/port.c b/port.c
> index 871ad68..8075896 100644
> --- a/port.c
> +++ b/port.c
> @@ -951,6 +951,9 @@ static int port_management_fill_response(struct port
> *target,
>                 }
>                 pds->logMinPdelayReqInterval =
> target->logMinPdelayReqInterval;
>                 pds->versionNumber           = target->versionNumber;
>

This structure follows the standard,
You can not add new values here!

> +               pds->syncReceiptTimeout      = target->syncReceiptTimeout;
> +               pds->delayRespReceiptTimeout =
> target->delay_response_timeout;
> +               pds->signalFail              = target->signalFail;
>                 datalen = sizeof(*pds);
>                 break;
>         case MID_LOG_ANNOUNCE_INTERVAL:
> @@ -1115,7 +1118,6 @@ static int port_management_set(struct port *target,
>         int respond = 0;
>         struct management_tlv *tlv;
>         struct port_ds_np *pdsnp;
> -
>         tlv = (struct management_tlv *) req->management.suffix;
>
>         switch (id) {
> @@ -1284,6 +1286,7 @@ static void port_synchronize(struct port *p,
>         enum servo_state state, last_state;
>         tmv_t t1, t1c, t2, c1, c2;
>
> +       p->signalFail &= ~PDS_PTSF_LOSS_SYNC;
>         port_set_sync_rx_tmo(p);
>
>         t1 = timestamp_to_tmv(origin_ts);
> @@ -1995,6 +1998,12 @@ int process_announce(struct port *p, struct
> ptp_message *m)
>                 return result;
>         }
>
> +       if (p->signalFail) {
> +               pr_debug("%s: Announce message ignored for signal fail\n",
> +                       p->name);
> +               return result;
> +       }
> +
>         if (m->announce.grandmasterClockQuality.clockClass >
>                 clock_get_clock_class_threshold(p->clock)) {
>                 pl_err(60, "%s: Master clock quality received is "
> @@ -2089,6 +2098,9 @@ void process_delay_resp(struct port *p, struct
> ptp_message *m)
>         struct ptp_message *req;
>         tmv_t c3, t3, t4, t4c;
>
> +       /* clear delay response time out. */
> +       p->signalFail &= ~PDS_PTSF_LOSS_DELAY_RESP;
> +
>         if (p->state != PS_UNCALIBRATED && p->state != PS_SLAVE) {
>                 return;
>         }
> @@ -2780,6 +2792,7 @@ static enum fsm_event bc_event(struct port *p, int
> fd_index)
>
>                 if (fd_index == FD_SYNC_RX_TIMER) {
>                         p->service_stats.sync_timeout++;
> +                       p->signalFail |= PDS_PTSF_LOSS_SYNC;
>                 } else {
>                         p->service_stats.announce_timeout++;
>                 }
> @@ -2821,6 +2834,7 @@ static enum fsm_event bc_event(struct port *p, int
> fd_index)
>                 if (p->delay_response_timeout && p->state == PS_SLAVE) {
>                         p->delay_response_counter++;
>                         if (p->delay_response_counter >=
> p->delay_response_timeout) {
> +                               p->signalFail |= PDS_PTSF_LOSS_DELAY_RESP;
>                                 p->delay_response_counter = 0;
>                                 tsproc_reset(clock_get_tsproc(p->clock),
> 1);
>                                 pr_err("%s: delay response timeout",
> p->log_name);
> diff --git a/port_private.h b/port_private.h
> index d27dceb..33422fd 100644
> --- a/port_private.h
> +++ b/port_private.h
> @@ -126,6 +126,7 @@ struct port {
>         Integer8            operLogPdelayReqInterval;
>         Integer8            logPdelayReqInterval;
>         UInteger32          neighborPropDelayThresh;
> +       UInteger8           signalFail;
>         int                 follow_up_info;
>         int                 freq_est_interval;
>         int                 hybrid_e2e;
> --
> 2.25.1
>
>
>
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
>
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to