[Linuxptp-devel] [PATCH v3 0/1] Add master only management TLV

2021-05-23 Thread Erez Geva
As we support the new master only flag.
Add the master only TLV to pmc tool.

v3: fix "master only" order according to TLV vlaue

Erez Geva (1):
  Add master only management TLV

 pmc.c| 5 +
 pmc_common.c | 2 ++
 port.c   | 6 ++
 3 files changed, 13 insertions(+)

-- 
2.20.1



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


[Linuxptp-devel] [PATCH v3 1/1] Add master only management TLV

2021-05-23 Thread Erez Geva
- Add support in the pmc tool
- Add the TLV in port module.

Signed-off-by: Erez Geva 
---
 pmc.c| 5 +
 pmc_common.c | 2 ++
 port.c   | 6 ++
 3 files changed, 13 insertions(+)

diff --git a/pmc.c b/pmc.c
index a767c8a..00d6014 100644
--- a/pmc.c
+++ b/pmc.c
@@ -335,6 +335,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
fprintf(fp, "TIMESCALE_PROPERTIES "
IFMT "ptpTimescale %d", mtd->val & PTP_TIMESCALE ? 1 : 
0);
break;
+   case TLV_MASTER_ONLY:
+   mtd = (struct management_tlv_datum *) mgt->data;
+   fprintf(fp, "MASTER_ONLY "
+   IFMT "masterOnly %d", mtd->val);
+   break;
case TLV_TIME_STATUS_NP:
tsn = (struct time_status_np *) mgt->data;
fprintf(fp, "TIME_STATUS_NP "
diff --git a/pmc_common.c b/pmc_common.c
index c5cd992..101df55 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -104,6 +104,7 @@ struct management_id idtab[] = {
{ "ALTERNATE_TIME_OFFSET_NAME", TLV_ALTERNATE_TIME_OFFSET_NAME, 
not_supported },
{ "ALTERNATE_TIME_OFFSET_MAX_KEY", TLV_ALTERNATE_TIME_OFFSET_MAX_KEY, 
not_supported },
{ "ALTERNATE_TIME_OFFSET_PROPERTIES", 
TLV_ALTERNATE_TIME_OFFSET_PROPERTIES, not_supported },
+   { "MASTER_ONLY", TLV_MASTER_ONLY, do_get_action },
{ "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", 
TLV_TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported },
{ "PRIMARY_DOMAIN", TLV_PRIMARY_DOMAIN, not_supported },
{ "TIME_STATUS_NP", TLV_TIME_STATUS_NP, do_get_action },
@@ -510,6 +511,7 @@ static int pmc_tlv_datalen(struct pmc *pmc, int id)
case TLV_CLOCK_ACCURACY:
case TLV_TRACEABILITY_PROPERTIES:
case TLV_TIMESCALE_PROPERTIES:
+   case TLV_MASTER_ONLY:
len += sizeof(struct management_tlv_datum);
break;
case TLV_TIME_STATUS_NP:
diff --git a/port.c b/port.c
index 10bb9e1..250d46d 100644
--- a/port.c
+++ b/port.c
@@ -924,6 +924,11 @@ static int port_management_fill_response(struct port 
*target,
mtd->val = target->versionNumber;
datalen = sizeof(*mtd);
break;
+   case TLV_MASTER_ONLY:
+   mtd = (struct management_tlv_datum *) tlv->data;
+   mtd->val = target->master_only;
+   datalen = sizeof(*mtd);
+   break;
case TLV_DELAY_MECHANISM:
mtd = (struct management_tlv_datum *) tlv->data;
if (target->delayMechanism)
@@ -2898,6 +2903,7 @@ int port_manage(struct port *p, struct port *ingress, 
struct ptp_message *msg)
case TLV_UNICAST_MASTER_MAX_TABLE_SIZE:
case TLV_ACCEPTABLE_MASTER_TABLE_ENABLED:
case TLV_ALTERNATE_MASTER:
+   case TLV_MASTER_ONLY:
case TLV_TRANSPARENT_CLOCK_PORT_DATA_SET:
case TLV_DELAY_MECHANISM:
case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
-- 
2.20.1



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


Re: [Linuxptp-devel] [PATCH v2 1/1] Add master only management TLV

2021-05-23 Thread Richard Cochran
On Mon, Apr 26, 2021 at 11:18:21AM +0200, Erez Geva wrote:

> diff --git a/pmc_common.c b/pmc_common.c
> index c5cd992..2ab32d4 100644
> --- a/pmc_common.c
> +++ b/pmc_common.c
> @@ -106,6 +106,7 @@ struct management_id idtab[] = {
>   { "ALTERNATE_TIME_OFFSET_PROPERTIES", 
> TLV_ALTERNATE_TIME_OFFSET_PROPERTIES, not_supported },

TLV_ALTERNATE_TIME_OFFSET_PROPERTIES0x2021

>   { "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", 
> TLV_TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported },

TLV_ALTERNATE_TIME_OFFSET_PROPERTIES0x2021

>   { "PRIMARY_DOMAIN", TLV_PRIMARY_DOMAIN, not_supported },

TLV_PRIMARY_DOMAIN  0x4002

> + { "MASTER_ONLY", TLV_MASTER_ONLY, do_get_action },

TLV_MASTER_ONLY 0x3001  out of order!

>   { "TIME_STATUS_NP", TLV_TIME_STATUS_NP, do_get_action },

TLV_TIME_STATUS_NP  0xC000

>   { "GRANDMASTER_SETTINGS_NP", TLV_GRANDMASTER_SETTINGS_NP, do_set_action 
> },

TLV_GRANDMASTER_SETTINGS_NP 0xC001

>   { "SUBSCRIBE_EVENTS_NP", TLV_SUBSCRIBE_EVENTS_NP, do_set_action },

TLV_SUBSCRIBE_EVENTS_NP 0xC003


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


Re: [Linuxptp-devel] [PATCH v4] Rework twoStepFlag in order to handle one step on port basis.

2021-05-23 Thread Richard Cochran
On Thu, Apr 22, 2021 at 09:18:33AM +0200, Luigi 'Comio' Mantellini wrote:
> With this patch we introduce the twoStepFlag evaluation at port level.

This isn't going to work.  The two step flag is an element of a clock,
not port, data set.

8.2.1.2.1 defaultDS.twoStepFlag

The value of defaultDS.twoStepFlag shall be TRUE if the clock is a
two-step clock; otherwise, the value shall be FALSE.

Sorry,
Richard


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


Re: [Linuxptp-devel] [PATCH] Set domainNumber for telecom examples

2021-05-23 Thread Richard Cochran
On Wed, Apr 21, 2021 at 07:41:48PM +0200, Lars Munch wrote:
> Set the default domain numbers according to the ITU-T standards
> 
> Signed-off-by: Lars Munch 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] Handle step_window at port level.

2021-05-23 Thread Richard Cochran
On Sun, May 23, 2021 at 09:31:39AM -0700, Richard Cochran wrote:
> On Mon, Apr 19, 2021 at 06:11:34PM +0200, Luigi 'Comio' Mantellini wrote:
> > From: Luigi Mantellini 
> > 
> > The step_window functionality should be defined at the port level because
> > we cannot assume that different ports have the same sync message rate.

And BTW, when submitting v2, v3, ... please always include a brief
Change Log explaining what has changed.  That helps the reviewers keep
track and makes their job easier.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] Handle step_window at port level.

2021-05-23 Thread Richard Cochran
On Mon, Apr 19, 2021 at 06:11:34PM +0200, Luigi 'Comio' Mantellini wrote:
> From: Luigi Mantellini 
> 
> The step_window functionality should be defined at the port level because
> we cannot assume that different ports have the same sync message rate.
> ---
>  clock.c| 13 +
>  clock.h|  5 +++--
>  config.c   |  2 +-
>  port.c | 18 +-
>  port.h |  7 +++
>  port_private.h |  1 +
>  6 files changed, 38 insertions(+), 8 deletions(-)
> 
> diff --git a/clock.c b/clock.c
> index e545a9b..6072ea0 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -710,6 +710,9 @@ static void clock_update_slave(struct clock *c)
>   pr_info("updating UTC offset to %d", c->tds.currentUtcOffset);
>   c->utc_offset = c->tds.currentUtcOffset;
>   }
> +
> + // Port changed
> + c->step_window_counter = 0;
>  }
>  
>  static int clock_utc_correct(struct clock *c, tmv_t ingress)
> @@ -1103,7 +1106,8 @@ struct clock *clock_create(enum clock_type type, struct 
> config *config,
>   c->kernel_leap = config_get_int(config, NULL, "kernel_leap");
>   c->utc_offset = config_get_int(config, NULL, "utc_offset");
>   c->time_source = config_get_int(config, NULL, "timeSource");
> - c->step_window = config_get_int(config, NULL, "step_window");
> + c->step_window = 0;
> + c->step_window_counter = 0;

If you really want to move the step window into the port, then delete
these fields from the clock data structure.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH 1/2] Log optimization for ptp4l in jbod and client only mode (clientOnly=1 and boundary_clock_jbod=1)

2021-05-23 Thread Richard Cochran
On Sat, May 22, 2021 at 05:09:07PM +0300, Amar Subramanyam via Linuxptp-devel 
wrote:
> The LISTENING port prints continuously
> "selected best master clock 00..03
> updating UTC offset to 37"
> 
> We limited the log such that now it prints only when there is a
> change in the best-master clock.
> 
> Signed-off-by: Amar Subramanyam 
> Signed-off-by: Karthikkumar Valoor 
> Signed-off-by: Ramana Reddy 
> ---
>  clock.c | 19 ++-
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/clock.c b/clock.c
> index e545a9b..2a95d79 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -1939,14 +1939,6 @@ static void handle_state_decision_event(struct clock 
> *c)
>   best_id = c->dds.clockIdentity;
>   }
>  
> - if (cid_eq(&best_id, &c->dds.clockIdentity)) {
> - pr_notice("selected local clock %s as best master",
> -   cid2str(&best_id));
> - } else {
> - pr_notice("selected best master clock %s",
> -   cid2str(&best_id));
> - }
> -
>   if (!cid_eq(&best_id, &c->best_id)) {
>   clock_freq_est_reset(c);
>   tsproc_reset(c->tsproc, 1);
> @@ -1957,6 +1949,13 @@ static void handle_state_decision_event(struct clock 
> *c)
>   c->master_local_rr = 1.0;
>   c->nrr = 1.0;
>   fresh_best = 1;
> + if (cid_eq(&best_id, &c->dds.clockIdentity)) {
> + pr_notice("selected local clock %s as best master",
> + cid2str(&best_id));
> + } else {
> + pr_notice("selected best master clock %s",
> + cid2str(&best_id));
> + }

This is a nice improvement as it prevent log spam in common
situations.

>   }
>  
>   c->best = best;
> @@ -1983,7 +1982,9 @@ static void handle_state_decision_event(struct clock *c)
>   event = EV_RS_PASSIVE;
>   break;
>   case PS_SLAVE:
> - clock_update_slave(c);
> + if (fresh_best) {
> + clock_update_slave(c);
> + }

This is not correct.  Elements of the upstream data sets might have
changed, and the port needs to stay up to date.

>   event = EV_RS_SLAVE;
>   break;
>   default:
> -- 
> 1.8.3.1

Thanks,
Richard


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