[Linuxptp-devel] The List Has Moved

2023-12-07 Thread Richard Cochran
Dear LinuxPTP developers,

New posts to this list has been disabled.  If you want to continue to
participate on the mailing lists, please subscribe to the new list at
the Network Time Foundation.

https://lists.nwtime.org/sympa/info/linuxptp-devel

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 6/6] Add example Common Mean Link Delay Service configuration files.

2023-12-06 Thread Richard Cochran
On Wed, Dec 06, 2023 at 03:43:15PM +0100, Andrew Zaborowski wrote:
> Again feel free to include it or leave it for us to send separately.

I prefer to roll your fixes into this series.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 6/6] Add example Common Mean Link Delay Service configuration files.

2023-12-05 Thread Richard Cochran
On Tue, Dec 05, 2023 at 02:44:18AM +0100, Andrew Zaborowski wrote:

>  * if I stop a CMLDS client and rerun it, it will receive the CMLDS
> notifications twice until the old subscription expires.  If I restart
> it again quickly enough it'll receive each notification 3 times.  This
> is because pmc_recv doesn't filter by .targetPortIdentity.  It could
> but it wouldn't be bullet proof anyway because the PMC port's identity
> is based on the pid, which is not unique, so I'm not sure if it's
> worth doing.

Yeah, super annoying.  Maybe the cure is to first cancel push
notifications unconditionally?
 
>  * inhibit_delay_req / logMinPdelayReqInterval /
> operLogPdelayReqInterval should not be used in the CMLDS client config
> (which wouldn't be useful anyway) because they'll affect the
> subscription renewals.

Right, a check should be added to avoid this combination.
 
>  * I had two extra changes, one to always calculate the NRR in the
> CMLDS port,

Can't this be taken from the Link Port?

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 6/6] Add example Common Mean Link Delay Service configuration files.

2023-12-05 Thread Richard Cochran
On Mon, Dec 04, 2023 at 10:51:15PM +0100, Andrew Zaborowski wrote:

> I assume ignore_transport_specific can be dropped in this version.

Actually it is critical, if you care about being able to
inter-operate.  After all, nothing guarantees that the link partner is
also running CMLDS.  Experience teaches us that the very first thing
users will do is the thing we think they shouldn't.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 4/6] Add a push notification for the CMLDS TLV.

2023-12-05 Thread Richard Cochran
On Tue, Dec 05, 2023 at 08:57:36AM +0100, Miroslav Lichvar wrote:
> On Mon, Dec 04, 2023 at 11:25:00PM +0100, Andrew Zaborowski wrote:

> > Doing cnt != 4 && cnt != 5 should just work as sscanf() should stop
> > parsing when it doesn't find NOTIFY_CMLDS and leave onoff_cmlds as
> > "off".  Obviously this won't scale as more events are added but it'd
> > keep syntax backwards-compatible for scripts.
> 
> Good idea. The PARENT_DATA_SET notification is new too (added after
> 4.1) and I guess there is no reason to require even the original two
> notifications, so change that to "cnt < 1" with "%s SET needs at least
> 1 value", requiring only the duration, which would effectively reset
> all existing notifications?

Makes sense to me.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v7 1/2] pmc_agent: Add option to run callback for signaling messages

2023-12-04 Thread Richard Cochran
On Mon, Dec 04, 2023 at 08:39:47AM +0100, Maciek Machnikowski wrote:
> Hey, please take a look at these patches and merge them if there are no
> bugs in this code.

I don't understand the need for this series.
What problem does it solve?

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-12-03 Thread Richard Cochran
On Sun, Dec 03, 2023 at 06:15:52PM -0800, Kishen Maloor wrote:
> On 12/1/23 10:07 PM, Richard Cochran wrote:
> > Does the standard require that either ALL the nodes in a network use
> > CMLDS, or none do at all?
> > 
> 
> When the time-aware system supports multiple domains, IEEE
> 802.1as-2020/11.2.17 mandates CMLDS and the COMMON_P2P DM.

Very narrow minded and short sighted.

Oh well, I wouldn't expect 802.1as to actually be practical.

Pass me the crazy sauce, please!

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2 0/6] Common Mean Link Delay Service (CMLDS)

2023-12-02 Thread Richard Cochran
On Sat, Dec 02, 2023 at 02:28:54PM -0800, Richard Cochran wrote:
> On Sat, Dec 02, 2023 at 02:24:52PM -0800, Richard Cochran wrote:
> 
> > Changes in v2
> > ~
> > - Added timer to renew push subscription and detect missing server.
> > - Addressed Andrew and Kishen's review comments.
> > - Added example configuration files.
> 
> I also updated the man page with the new config options.
> Still need to add COMMON_P2P into man page.

And this v2 is buggy, please ignore in favor of v3.

Thanks,
Richard


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


[Linuxptp-devel] [PATCH v3 2/6] pmc/uds: Configure the remote server address using the interface API.

2023-12-02 Thread Richard Cochran
The UDS uses a global setting from the configuration to set the remote
server address.  As a result, a program cannot act as both a UDS
client and server, because the source and destination addresses would
be identical.  Fix the issue by allowing the remote address to be
configurable.

Signed-off-by: Richard Cochran 
---
 pmc.c| 6 --
 pmc_agent.c  | 3 ++-
 pmc_common.c | 8 
 pmc_common.h | 6 +++---
 tz2alt.c | 3 ++-
 uds.c| 6 --
 6 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/pmc.c b/pmc.c
index 9faf790..d18fea0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -823,8 +823,10 @@ int main(int argc, char *argv[])
print_set_syslog(1);
print_set_verbose(1);
 
-   pmc = pmc_create(cfg, transport_type, iface_name, boundary_hops,
-domain_number, transport_specific, zero_datalen);
+   pmc = pmc_create(cfg, transport_type, iface_name,
+config_get_string(cfg, NULL, "uds_address"),
+boundary_hops, domain_number, transport_specific,
+zero_datalen);
if (!pmc) {
fprintf(stderr, "failed to create pmc\n");
config_destroy(cfg);
diff --git a/pmc_agent.c b/pmc_agent.c
index 494c174..fec6dea 100644
--- a/pmc_agent.c
+++ b/pmc_agent.c
@@ -232,7 +232,8 @@ int run_pmc_wait_sync(struct pmc_agent *node, int timeout)
 int init_pmc_node(struct config *cfg, struct pmc_agent *node, const char *uds,
  pmc_node_recv_subscribed_t *recv_subscribed, void *context)
 {
-   node->pmc = pmc_create(cfg, TRANS_UDS, uds, 0,
+   node->pmc = pmc_create(cfg, TRANS_UDS, uds,
+  config_get_string(cfg, NULL, "uds_address"), 0,
   config_get_int(cfg, NULL, "domainNumber"),
   config_get_int(cfg, NULL, "transportSpecific") 
<< 4, 1);
if (!node->pmc) {
diff --git a/pmc_common.c b/pmc_common.c
index 5092c09..fca16c6 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -488,9 +488,9 @@ struct pmc {
 };
 
 struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
-  const char *iface_name, UInteger8 boundary_hops,
-  UInteger8 domain_number, UInteger8 transport_specific,
-  int zero_datalen)
+  const char *iface_name, const char *remote_address,
+  UInteger8 boundary_hops, UInteger8 domain_number,
+  UInteger8 transport_specific, int zero_datalen)
 {
struct pmc *pmc;
UInteger32 proc_id;
@@ -524,7 +524,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
goto failed;
}
 
-   pmc->iface = interface_create(iface_name, NULL);
+   pmc->iface = interface_create(iface_name, remote_address);
if (!pmc->iface) {
pr_err("failed to create interface");
goto failed;
diff --git a/pmc_common.h b/pmc_common.h
index 6fb2fae..355b2c0 100644
--- a/pmc_common.h
+++ b/pmc_common.h
@@ -29,9 +29,9 @@
 struct pmc;
 
 struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
-  const char *iface_name, UInteger8 boundary_hops,
-  UInteger8 domain_number, UInteger8 transport_specific,
-  int zero_datalen);
+  const char *iface_name, const char *remote_address,
+  UInteger8 boundary_hops, UInteger8 domain_number,
+  UInteger8 transport_specific, int zero_datalen);
 
 void pmc_destroy(struct pmc *pmc);
 
diff --git a/tz2alt.c b/tz2alt.c
index feb77a5..65b5835 100644
--- a/tz2alt.c
+++ b/tz2alt.c
@@ -181,7 +181,8 @@ static int update_ptp_serivce(struct tzinfo *tz, struct 
tzinfo *next)
struct pmc *pmc;
int err;
 
-   pmc = pmc_create(cfg, TRANS_UDS, uds_local, 0,
+   pmc = pmc_create(cfg, TRANS_UDS, uds_local,
+config_get_string(cfg, NULL, "uds_address"), 0,
 config_get_int(cfg, NULL, "domainNumber"),
 config_get_int(cfg, NULL, "transportSpecific") << 4, 
1);
if (!pmc) {
diff --git a/uds.c b/uds.c
index 6d39dc8..fafb100 100644
--- a/uds.c
+++ b/uds.c
@@ -54,7 +54,7 @@ static int uds_open(struct transport *t, struct interface 
*iface, struct fdarray
enum timestamp_type tt)
 {
char *uds_ro_path = config_get_string(t->cfg, NULL, "uds_ro_address");
-   char *uds_path = config_get_string(t->cfg, NULL, "uds_address");
+   const char *uds_path = interface_remote(iface);
struct uds *uds = container_of(t, struct uds, t);
const char *name = interface_name(iface);
const char* file_mode_cfg;
@@ -8

[Linuxptp-devel] [PATCH v3 6/6] Add example Common Mean Link Delay Service configuration files.

2023-12-02 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 configs/CMLDS_client.cfg | 10 ++
 configs/CMLDS_server.cfg | 16 
 2 files changed, 26 insertions(+)
 create mode 100644 configs/CMLDS_client.cfg
 create mode 100644 configs/CMLDS_server.cfg

diff --git a/configs/CMLDS_client.cfg b/configs/CMLDS_client.cfg
new file mode 100644
index 000..ef10fef
--- /dev/null
+++ b/configs/CMLDS_client.cfg
@@ -0,0 +1,10 @@
+#
+# Common Mean Link Delay Service (CMLDS) example configuration for a
+# CMLDS client, containing those attributes which differ from the
+# defaults.  See the file, default.cfg, for the complete list of
+# available options.
+#
+[global]
+
+[eth1]
+delay_mechanismCOMMON_P2P
diff --git a/configs/CMLDS_server.cfg b/configs/CMLDS_server.cfg
new file mode 100644
index 000..36f118c
--- /dev/null
+++ b/configs/CMLDS_server.cfg
@@ -0,0 +1,16 @@
+#
+# Common Mean Link Delay Service (CMLDS) example configuration for a
+# CMLDS Link Port, containing those attributes which differ from the
+# defaults.  See the file, default.cfg, for the complete list of
+# available options.
+#
+[global]
+clientOnly 1
+clockIdentity  C37D50..00
+free_running   1
+ignore_transport_specific  1
+transportSpecific  2
+uds_address/var/run/cmlds_server
+
+[eth1]
+delay_mechanismP2P
-- 
2.39.2



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


[Linuxptp-devel] [PATCH v3 3/6] Introduce the Common Mean Link Delay Information TLV.

2023-12-02 Thread Richard Cochran
Add a new TLV to convey link delay measurements by the Common Mean
Link Delay Service (CMLDS) (as specified in IEEE 1588/16.6.3) over the
management interface.

Co-authored-by: Andrew Zaborowski 
Signed-off-by: Kishen Maloor 
Signed-off-by: Richard Cochran 
---
 clock.c  |  1 -
 pmc.c| 11 +++
 pmc_common.c |  1 +
 port.c   |  9 +
 port.h   |  2 ++
 tlv.c| 16 
 tlv.h|  7 +++
 7 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index 6f7722c..c999c83 100644
--- a/clock.c
+++ b/clock.c
@@ -47,7 +47,6 @@
 #include "util.h"
 
 #define N_CLOCK_PFD (N_POLLFD + 1) /* one extra per port, for the fault timer 
*/
-#define POW2_41 ((double)(1ULL << 41))
 
 struct interface {
STAILQ_ENTRY(interface) list;
diff --git a/pmc.c b/pmc.c
index d18fea0..12a6109 100644
--- a/pmc.c
+++ b/pmc.c
@@ -169,6 +169,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
struct subscribe_events_np *sen;
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
+   struct cmlds_info_np *cmlds;
struct timePropertiesDS *tp;
struct management_tlv *mgt;
struct time_status_np *tsn;
@@ -623,6 +624,16 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
pwr->networkTimeInaccuracy,
pwr->totalTimeInaccuracy);
break;
+   case MID_CMLDS_INFO_NP:
+   cmlds = (struct cmlds_info_np *) mgt->data;
+   fprintf(fp, "CMLDS_INFO_NP "
+   IFMT "meanLinkDelay   %" PRId64
+   IFMT "scaledNeighborRateRatio %" PRId32
+   IFMT "as_capable  %" PRIu32,
+   cmlds->meanLinkDelay >> 16,
+   cmlds->scaledNeighborRateRatio,
+   cmlds->as_capable);
+   break;
case MID_LOG_ANNOUNCE_INTERVAL:
mtd = (struct management_tlv_datum *) mgt->data;
fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
diff --git a/pmc_common.c b/pmc_common.c
index fca16c6..1d537f2 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -156,6 +156,7 @@ struct management_id idtab[] = {
{ "UNICAST_MASTER_TABLE_NP", MID_UNICAST_MASTER_TABLE_NP, do_get_action 
},
{ "PORT_HWCLOCK_NP", MID_PORT_HWCLOCK_NP, do_get_action },
{ "POWER_PROFILE_SETTINGS_NP", MID_POWER_PROFILE_SETTINGS_NP, 
do_set_action },
+   { "CMLDS_INFO_NP", MID_CMLDS_INFO_NP, do_get_action },
 };
 
 static void do_get_action(struct pmc *pmc, int action, int index, char *str)
diff --git a/port.c b/port.c
index b7fbfb1..2eca876 100644
--- a/port.c
+++ b/port.c
@@ -883,6 +883,7 @@ static int port_management_fill_response(struct port 
*target,
struct clock_description *desc;
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
+   struct cmlds_info_np *cmlds;
struct management_tlv *tlv;
struct port_stats_np *psn;
struct foreign_clock *fc;
@@ -1125,6 +1126,14 @@ static int port_management_fill_response(struct port 
*target,
memcpy(pwr, >pwr, sizeof(*pwr));
datalen = sizeof(*pwr);
break;
+   case MID_CMLDS_INFO_NP:
+   cmlds = (struct cmlds_info_np *)tlv->data;
+   cmlds->meanLinkDelay = target->peerMeanPathDelay;
+   cmlds->scaledNeighborRateRatio =
+   (Integer32) (target->nrate.ratio * POW2_41 - POW2_41);
+   cmlds->as_capable = target->asCapable;
+   datalen = sizeof(*cmlds);
+   break;
default:
/* The caller should *not* respond to this message. */
tlv_extra_recycle(extra);
diff --git a/port.h b/port.h
index 57c8c2f..cc03859 100644
--- a/port.h
+++ b/port.h
@@ -26,6 +26,8 @@
 #include "notification.h"
 #include "transport.h"
 
+#define POW2_41 ((double)(1ULL << 41))
+
 /* forward declarations */
 struct interface;
 struct clock;
diff --git a/tlv.c b/tlv.c
index 9b82bd9..7cbd84d 100644
--- a/tlv.c
+++ b/tlv.c
@@ -176,6 +176,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t 
data_len,
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
struct timePropertiesDS *tp;
+   struct cmlds_info_np *cmlds;
struct time_status_np *tsn;
struct port_stats_np *psn;
int extra_len = 0, i, len;
@@ -481,6 +482,14 @@ static int mgt_post_recv(struct management_tlv *m, 
uint16_t data_len,
NTOHL(pwr->networkTimeInaccuracy);
NTOHL(pwr->totalTimeInaccuracy);
break;
+   case MID_CMLDS_INFO_NP:
+   if (data_len < sizeof(struct cml

[Linuxptp-devel] [PATCH v3 5/6] Implement the COMMON_P2P delay mechanism.

2023-12-02 Thread Richard Cochran
If a given port selects the COMMON_P2P delay mechanism, let it open a
local PTP Management channel to the Common Mean Link Delay Service
over a UNIX domain socket.

Signed-off-by: Richard Cochran 
---
 config.c|   6 ++
 configs/default.cfg |   5 ++
 dm.h|   3 +
 fd.h|   1 +
 makefile|   4 +-
 port.c  | 181 +---
 port_private.h  |   7 ++
 ptp4l.8 |  39 +-
 8 files changed, 233 insertions(+), 13 deletions(-)

diff --git a/config.c b/config.c
index fe65b76..8cf1620 100644
--- a/config.c
+++ b/config.c
@@ -171,6 +171,7 @@ static struct config_enum delay_filter_enu[] = {
 
 static struct config_enum delay_mech_enu[] = {
{ "Auto", DM_AUTO },
+   { "COMMON_P2P", DM_COMMON_P2P },
{ "E2E",  DM_E2E },
{ "P2P",  DM_P2P },
{ "NONE", DM_NO_MECHANISM },
@@ -249,6 +250,11 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("clock_class_threshold", CLOCK_CLASS_THRESHOLD_DEFAULT, 
6, CLOCK_CLASS_THRESHOLD_DEFAULT),
GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
GLOB_ITEM_ENU("clock_type", CLOCK_TYPE_ORDINARY, clock_type_enu),
+   PORT_ITEM_STR("cmlds.client_address", "/var/run/cmlds_cleint"),
+   PORT_ITEM_INT("cmlds.domainNumber", 0, 0, 255),
+   PORT_ITEM_INT("cmlds.majorSdoId", 2, 0, 0x0F),
+   PORT_ITEM_INT("cmlds.port", 0, 0, UINT16_MAX),
+   PORT_ITEM_STR("cmlds.server_address", "/var/run/cmlds_server"),
GLOB_ITEM_ENU("dataset_comparison", DS_CMP_IEEE1588, dataset_comp_enu),
PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX),
PORT_ITEM_ENU("delay_filter", FILTER_MOVING_MEDIAN, delay_filter_enu),
diff --git a/configs/default.cfg b/configs/default.cfg
index 0c7661c..29a34fd 100644
--- a/configs/default.cfg
+++ b/configs/default.cfg
@@ -93,6 +93,11 @@ write_phase_mode 0
 #
 # Transport options
 #
+cmlds.client_address   /var/run/cmlds_cleint
+cmlds.domainNumber 0
+cmlds.majorSdoId   2
+cmlds.port 0
+cmlds.server_address   /var/run/cmlds_server
 transportSpecific  0x0
 ptp_dst_mac01:1B:19:00:00:00
 p2p_dst_mac01:80:C2:00:00:0E
diff --git a/dm.h b/dm.h
index 47bd847..80d1ce5 100644
--- a/dm.h
+++ b/dm.h
@@ -34,6 +34,9 @@ enum delay_mechanism {
/** Peer delay mechanism. */
DM_P2P,
 
+   /** Peer delay as measured by CMLDS. */
+   DM_COMMON_P2P,
+
/** No Delay Mechanism. */
DM_NO_MECHANISM = 0xFE,
 };
diff --git a/fd.h b/fd.h
index 16420d7..9a072ab 100644
--- a/fd.h
+++ b/fd.h
@@ -39,6 +39,7 @@ enum {
FD_SYNC_TX_TIMER,
FD_UNICAST_REQ_TIMER,
FD_UNICAST_SRV_TIMER,
+   FD_CMLDS,
FD_RTNL,
N_POLLFD,
 };
diff --git a/makefile b/makefile
index 7fc5f6f..e9c1ccc 100644
--- a/makefile
+++ b/makefile
@@ -30,8 +30,8 @@ TS2PHC= ts2phc.o lstab.o nmea.o serial.o sock.o 
ts2phc_generic_pps_source.o \
  ts2phc_nmea_pps_source.o ts2phc_phc_pps_source.o ts2phc_pps_sink.o 
ts2phc_pps_source.o
 OBJ= bmc.o clock.o clockadj.o clockcheck.o config.o designated_fsm.o \
  e2e_tc.o fault.o $(FILTERS) fsm.o hash.o interface.o monitor.o msg.o phc.o \
- port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) \
- sk.o stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o \
+ pmc_common.o port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o 
\
+ $(SERVOS) sk.o stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o 
unicast_client.o \
  unicast_fsm.o unicast_service.o util.o version.o
 
 OBJECTS= $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o 
pmc_agent.o \
diff --git a/port.c b/port.c
index 23f021c..e2ebaeb 100644
--- a/port.c
+++ b/port.c
@@ -46,6 +46,8 @@
 #include "util.h"
 
 #define ANNOUNCE_SPAN 1
+#define CMLDS_SUBSCRIPTION_INTERVAL60 /*seconds*/
+#define CMLDS_UPDATE_INTERVAL  (CMLDS_SUBSCRIPTION_INTERVAL / 2)
 
 enum syfu_event {
SYNC_MISMATCH,
@@ -965,7 +967,8 @@ static int port_management_fill_response(struct port 
*target,
ptp_text_copy(cd->userDescription, >userDescription);
buf += sizeof(struct PTPText) + cd->userDescription->length;
 
-   if (target->delayMechanism == DM_P2P) {
+   if (target->delayMechanism == DM_P2P ||
+   target->delayMechanism == DM_COMMON_P2P) {
memcpy(buf, profile_id_p2p, PROFILE_ID_LEN);
} else {
struct config *cfg = clock_config(target->clock);
@@ -1275,14 +1278,16 @@ int port_set_delay_tmo(struct port *p)
if (p->inhibit_delay_req) {
return 0;
}
-
-   i

[Linuxptp-devel] [PATCH v3 1/6] interface: Add an optional remote address for use by the UDS transport.

2023-12-02 Thread Richard Cochran
Because of the implementation of the UDS module, it is not possible
for a process to act as both a PTP management client (PMC) and server.
Going forward, one ptp4l instance will need to subscribe to another
using the PMC methods.  Pave the way by allowing the interface to
include an optional remote UDS address.

Signed-off-by: Richard Cochran 
---
 clock.c  |  4 ++--
 config.c |  2 +-
 interface.c  | 12 ++--
 interface.h  | 10 +-
 pmc_common.c |  2 +-
 5 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/clock.c b/clock.c
index b66dda5..6f7722c 100644
--- a/clock.c
+++ b/clock.c
@@ -1242,7 +1242,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
/* Configure the UDS. */
 
uds_ifname = config_get_string(config, NULL, "uds_address");
-   c->uds_rw_if = interface_create(uds_ifname);
+   c->uds_rw_if = interface_create(uds_ifname, NULL);
if (config_set_section_int(config, interface_name(c->uds_rw_if),
   "announceReceiptTimeout", 0)) {
return NULL;
@@ -1261,7 +1261,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
}
 
uds_ifname = config_get_string(config, NULL, "uds_ro_address");
-   c->uds_ro_if = interface_create(uds_ifname);
+   c->uds_ro_if = interface_create(uds_ifname, NULL);
if (config_set_section_int(config, interface_name(c->uds_ro_if),
   "announceReceiptTimeout", 0)) {
return NULL;
diff --git a/config.c b/config.c
index ad675c8..fe65b76 100644
--- a/config.c
+++ b/config.c
@@ -896,7 +896,7 @@ struct interface *config_create_interface(const char *name, 
struct config *cfg)
return iface;
}
 
-   iface = interface_create(name);
+   iface = interface_create(name, NULL);
if (!iface) {
fprintf(stderr, "cannot allocate memory for a port\n");
return NULL;
diff --git a/interface.c b/interface.c
index 9a83c36..e088e07 100644
--- a/interface.c
+++ b/interface.c
@@ -12,12 +12,13 @@ struct interface {
STAILQ_ENTRY(interface) list;
char name[MAX_IFNAME_SIZE + 1];
char ts_label[MAX_IFNAME_SIZE + 1];
+   char remote[MAX_IFNAME_SIZE + 1];
struct sk_ts_info ts_info;
struct sk_if_info if_info;
int vclock;
 };
 
-struct interface *interface_create(const char *name)
+struct interface *interface_create(const char *name, const char *remote)
 {
struct interface *iface;
 
@@ -27,6 +28,9 @@ struct interface *interface_create(const char *name)
}
strncpy(iface->name, name, MAX_IFNAME_SIZE);
strncpy(iface->ts_label, name, MAX_IFNAME_SIZE);
+   if (remote) {
+   strncpy(iface->remote, remote, MAX_IFNAME_SIZE);
+   }
iface->vclock = -1;
 
return iface;
@@ -57,7 +61,6 @@ bool interface_ifinfo_valid(struct interface *iface)
return iface->if_info.valid ? true : false;
 }
 
-
 const char *interface_name(struct interface *iface)
 {
return iface->name;
@@ -68,6 +71,11 @@ int interface_phc_index(struct interface *iface)
return iface->ts_info.phc_index;
 }
 
+const char *interface_remote(struct interface *iface)
+{
+   return iface->remote;
+}
+
 void interface_set_label(struct interface *iface, const char *label)
 {
strncpy(iface->ts_label, label, MAX_IFNAME_SIZE);
diff --git a/interface.h b/interface.h
index 0873bba..b56adc5 100644
--- a/interface.h
+++ b/interface.h
@@ -23,9 +23,10 @@ struct interface;
 /**
  * Creates an instance of an interface.
  * @param name  The device which indentifies this interface.
+ * @param remote  For UDS interfaces, the address of the remote server, 
possibly NULL.
  * @return  A pointer to an interface instance on success, NULL otherwise.
  */
-struct interface *interface_create(const char *name);
+struct interface *interface_create(const char *name, const char *remote);
 
 /**
  * Destroys an instance of an interface.
@@ -70,6 +71,13 @@ const char *interface_name(struct interface *iface);
  */
 int interface_phc_index(struct interface *iface);
 
+/**
+ * Obtains the remote address from a UDS interface.
+ * @param iface  The interface of interest.
+ * @return   The device name of the network interface.
+ */
+const char *interface_remote(struct interface *iface);
+
 /**
  * Set the time stamping label of a given interface.
  * @param iface  The interface of interest.
diff --git a/pmc_common.c b/pmc_common.c
index 62e34a6..5092c09 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -524,7 +524,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
goto failed;
}
 
-   pmc->iface = interface_create(iface_name);
+   pmc->iface = interface_create(iface_name, NULL);

[Linuxptp-devel] [PATCH v3 0/6] Common Mean Link Delay Service (CMLDS)

2023-12-02 Thread Richard Cochran
The CMLDS lets one peer-to-peer delay measurement be shared among
multiple PTP stack instances running on the same host.

To try it, connect the Ethernet ports of two hosts directly:

On one host run CMLDS setup:

   ptp4l -mqf CMLDS_server.cfg
   ptp4l -mqf CMLDS_client.cfg

and on the other host run a normal P2P stack:

   ptp4l -mqi eth1 -P --ignore_transport_specific=1

(The ignore_transport_specific is needed because of the extremely
silly way the majorSdoId aka transportSpecific field is specified in
1588.)


Changes in v3
~
- Make delay timer a) actually fire, and b) do the right thing.
- Add COMMOM_P2P to the list of delay mechanisms in the man page.

Changes in v2
~
- Added timer to renew push subscription and detect missing server.
- Addressed Andrew and Kishen's review comments.
- Added example configuration files.


Richard Cochran (6):
  interface: Add an optional remote address for use by the UDS
transport.
  pmc/uds: Configure the remote server address using the interface API.
  Introduce the Common Mean Link Delay Information TLV.
  Add a push notification for the CMLDS TLV.
  Implement the COMMON_P2P delay mechanism.
  Add example Common Mean Link Delay Service configuration files.

 clock.c  |   5 +-
 config.c |   8 +-
 configs/CMLDS_client.cfg |  10 ++
 configs/CMLDS_server.cfg |  16 
 configs/default.cfg  |   5 +
 dm.h |   3 +
 fd.h |   1 +
 interface.c  |  12 ++-
 interface.h  |  10 +-
 makefile |   4 +-
 notification.h   |   1 +
 pmc.c|  23 -
 pmc_agent.c  |   3 +-
 pmc_common.c |  23 +++--
 pmc_common.h |   6 +-
 port.c   | 197 +--
 port.h   |   2 +
 port_private.h   |   7 ++
 ptp4l.8  |  39 +++-
 tlv.c|  16 
 tlv.h|   7 ++
 tz2alt.c |   3 +-
 uds.c|   6 +-
 23 files changed, 368 insertions(+), 39 deletions(-)
 create mode 100644 configs/CMLDS_client.cfg
 create mode 100644 configs/CMLDS_server.cfg

-- 
2.39.2



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


[Linuxptp-devel] [PATCH v3 4/6] Add a push notification for the CMLDS TLV.

2023-12-02 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 notification.h |  1 +
 pmc.c  |  6 --
 pmc_common.c   | 14 ++
 port.c |  7 +++
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/notification.h b/notification.h
index c1a6395..7a8f641 100644
--- a/notification.h
+++ b/notification.h
@@ -45,6 +45,7 @@ enum notification {
NOTIFY_PORT_STATE,
NOTIFY_TIME_SYNC,
NOTIFY_PARENT_DATA_SET,
+   NOTIFY_CMLDS,
 };
 
 #endif
diff --git a/pmc.c b/pmc.c
index 12a6109..6cdd7b0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -453,11 +453,13 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
IFMT "duration   %hu"
IFMT "NOTIFY_PORT_STATE  %s"
IFMT "NOTIFY_TIME_SYNC   %s"
-   IFMT "NOTIFY_PARENT_DATA_SET %s",
+   IFMT "NOTIFY_PARENT_DATA_SET %s"
+   IFMT "NOTIFY_CMLDS   %s",
sen->duration,
event_bitmask_get(sen->bitmask, NOTIFY_PORT_STATE) ? 
"on" : "off",
event_bitmask_get(sen->bitmask, NOTIFY_TIME_SYNC) ? 
"on" : "off",
-   event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off");
+   event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off",
+   event_bitmask_get(sen->bitmask, NOTIFY_CMLDS) ? "on" : 
"off");
break;
case MID_SYNCHRONIZATION_UNCERTAIN_NP:
mtd = (struct management_tlv_datum *) mgt->data;
diff --git a/pmc_common.c b/pmc_common.c
index 1d537f2..a549af5 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -180,6 +180,7 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
char onoff_port_state[4] = "off";
char onoff_time_status[4] = "off";
char onoff_parent_data_set[4] = "off";
+   char onoff_cmlds[4] = "off";
char display_name[11] = {0};
uint64_t jump;
uint8_t key;
@@ -306,13 +307,15 @@ static void do_set_action(struct pmc *pmc, int action, 
int index, char *str)
 "duration  %hu "
 "NOTIFY_PORT_STATE %3s "
 "NOTIFY_TIME_SYNC  %3s "
-"NOTIFY_PARENT_DATA_SET %3s ",
+"NOTIFY_PARENT_DATA_SET %3s "
+"NOTIFY_CMLDS %3s ",
 ,
 onoff_port_state,
 onoff_time_status,
-onoff_parent_data_set);
-   if (cnt != 4) {
-   fprintf(stderr, "%s SET needs 4 values\n",
+onoff_parent_data_set,
+onoff_cmlds);
+   if (cnt != 5) {
+   fprintf(stderr, "%s SET needs 5 values\n",
idtab[index].name);
break;
}
@@ -326,6 +329,9 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
event_bitmask_set(sen.bitmask, NOTIFY_PARENT_DATA_SET,
  TRUE);
}
+   if (!strcasecmp(onoff_cmlds, "on")) {
+   event_bitmask_set(sen.bitmask, NOTIFY_CMLDS, TRUE);
+   }
pmc_send_set_action(pmc, code, , sizeof(sen));
break;
case MID_SYNCHRONIZATION_UNCERTAIN_NP:
diff --git a/port.c b/port.c
index 2eca876..23f021c 100644
--- a/port.c
+++ b/port.c
@@ -748,6 +748,7 @@ capable:
if (p->asCapable == NOT_CAPABLE) {
pr_debug("%s: setting asCapable", p->log_name);
p->asCapable = AS_CAPABLE;
+   port_notify_event(p, NOTIFY_CMLDS);
}
return 1;
 
@@ -755,6 +756,7 @@ not_capable:
if (p->asCapable)
port_nrate_initialize(p);
p->asCapable = NOT_CAPABLE;
+   port_notify_event(p, NOTIFY_CMLDS);
return 0;
 }
 
@@ -2467,6 +2469,8 @@ calc:
 
msg_put(p->peer_delay_req);
p->peer_delay_req = NULL;
+
+   port_notify_event(p, NOTIFY_CMLDS);
 }
 
 int process_pdelay_resp(struct port *p, struct ptp_message *m)
@@ -3264,6 +3268,9 @@ void port_notify_event(struct port *p, enum notification 
event)
case NOTIFY_PORT_STATE:
id = MID_PORT_DATA_SET;
break;
+   case NOTIFY_CMLDS:
+   id = MID_CMLDS_INFO_NP;
+   break;
default:
return;
}
-- 
2.39.2



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


Re: [Linuxptp-devel] [PATCH v2 0/6] Common Mean Link Delay Service (CMLDS)

2023-12-02 Thread Richard Cochran
On Sat, Dec 02, 2023 at 02:24:52PM -0800, Richard Cochran wrote:

> Changes in v2
> ~
> - Added timer to renew push subscription and detect missing server.
> - Addressed Andrew and Kishen's review comments.
> - Added example configuration files.

I also updated the man page with the new config options.
Still need to add COMMON_P2P into man page.

Thanks,
Richard


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


[Linuxptp-devel] [PATCH v2 5/6] Implement the COMMON_P2P delay mechanism.

2023-12-02 Thread Richard Cochran
If a given port selects the COMMON_P2P delay mechanism, let it open a
local PTP Management channel to the Common Mean Link Delay Service
over a UNIX domain socket.

Signed-off-by: Richard Cochran 
---
 config.c|   6 ++
 configs/default.cfg |   5 ++
 dm.h|   3 +
 fd.h|   1 +
 makefile|   4 +-
 port.c  | 180 +---
 port_private.h  |   7 ++
 ptp4l.8 |  35 +
 8 files changed, 228 insertions(+), 13 deletions(-)

diff --git a/config.c b/config.c
index fe65b76..8cf1620 100644
--- a/config.c
+++ b/config.c
@@ -171,6 +171,7 @@ static struct config_enum delay_filter_enu[] = {
 
 static struct config_enum delay_mech_enu[] = {
{ "Auto", DM_AUTO },
+   { "COMMON_P2P", DM_COMMON_P2P },
{ "E2E",  DM_E2E },
{ "P2P",  DM_P2P },
{ "NONE", DM_NO_MECHANISM },
@@ -249,6 +250,11 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("clock_class_threshold", CLOCK_CLASS_THRESHOLD_DEFAULT, 
6, CLOCK_CLASS_THRESHOLD_DEFAULT),
GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
GLOB_ITEM_ENU("clock_type", CLOCK_TYPE_ORDINARY, clock_type_enu),
+   PORT_ITEM_STR("cmlds.client_address", "/var/run/cmlds_cleint"),
+   PORT_ITEM_INT("cmlds.domainNumber", 0, 0, 255),
+   PORT_ITEM_INT("cmlds.majorSdoId", 2, 0, 0x0F),
+   PORT_ITEM_INT("cmlds.port", 0, 0, UINT16_MAX),
+   PORT_ITEM_STR("cmlds.server_address", "/var/run/cmlds_server"),
GLOB_ITEM_ENU("dataset_comparison", DS_CMP_IEEE1588, dataset_comp_enu),
PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX),
PORT_ITEM_ENU("delay_filter", FILTER_MOVING_MEDIAN, delay_filter_enu),
diff --git a/configs/default.cfg b/configs/default.cfg
index 0c7661c..29a34fd 100644
--- a/configs/default.cfg
+++ b/configs/default.cfg
@@ -93,6 +93,11 @@ write_phase_mode 0
 #
 # Transport options
 #
+cmlds.client_address   /var/run/cmlds_cleint
+cmlds.domainNumber 0
+cmlds.majorSdoId   2
+cmlds.port 0
+cmlds.server_address   /var/run/cmlds_server
 transportSpecific  0x0
 ptp_dst_mac01:1B:19:00:00:00
 p2p_dst_mac01:80:C2:00:00:0E
diff --git a/dm.h b/dm.h
index 47bd847..80d1ce5 100644
--- a/dm.h
+++ b/dm.h
@@ -34,6 +34,9 @@ enum delay_mechanism {
/** Peer delay mechanism. */
DM_P2P,
 
+   /** Peer delay as measured by CMLDS. */
+   DM_COMMON_P2P,
+
/** No Delay Mechanism. */
DM_NO_MECHANISM = 0xFE,
 };
diff --git a/fd.h b/fd.h
index 16420d7..9a072ab 100644
--- a/fd.h
+++ b/fd.h
@@ -39,6 +39,7 @@ enum {
FD_SYNC_TX_TIMER,
FD_UNICAST_REQ_TIMER,
FD_UNICAST_SRV_TIMER,
+   FD_CMLDS,
FD_RTNL,
N_POLLFD,
 };
diff --git a/makefile b/makefile
index 7fc5f6f..e9c1ccc 100644
--- a/makefile
+++ b/makefile
@@ -30,8 +30,8 @@ TS2PHC= ts2phc.o lstab.o nmea.o serial.o sock.o 
ts2phc_generic_pps_source.o \
  ts2phc_nmea_pps_source.o ts2phc_phc_pps_source.o ts2phc_pps_sink.o 
ts2phc_pps_source.o
 OBJ= bmc.o clock.o clockadj.o clockcheck.o config.o designated_fsm.o \
  e2e_tc.o fault.o $(FILTERS) fsm.o hash.o interface.o monitor.o msg.o phc.o \
- port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) \
- sk.o stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o \
+ pmc_common.o port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o 
\
+ $(SERVOS) sk.o stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o 
unicast_client.o \
  unicast_fsm.o unicast_service.o util.o version.o
 
 OBJECTS= $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o 
pmc_agent.o \
diff --git a/port.c b/port.c
index 23f021c..88d794e 100644
--- a/port.c
+++ b/port.c
@@ -46,6 +46,8 @@
 #include "util.h"
 
 #define ANNOUNCE_SPAN 1
+#define CMLDS_SUBSCRIPTION_INTERVAL60 /*seconds*/
+#define CMLDS_UPDATE_INTERVAL  (CMLDS_SUBSCRIPTION_INTERVAL / 2)
 
 enum syfu_event {
SYNC_MISMATCH,
@@ -965,7 +967,8 @@ static int port_management_fill_response(struct port 
*target,
ptp_text_copy(cd->userDescription, >userDescription);
buf += sizeof(struct PTPText) + cd->userDescription->length;
 
-   if (target->delayMechanism == DM_P2P) {
+   if (target->delayMechanism == DM_P2P ||
+   target->delayMechanism == DM_COMMON_P2P) {
memcpy(buf, profile_id_p2p, PROFILE_ID_LEN);
} else {
struct config *cfg = clock_config(target->clock);
@@ -1275,14 +1278,16 @@ int port_set_delay_tmo(struct port *p)
if (p->inhibit_delay_req) {
return 0;
}
-
-   i

[Linuxptp-devel] [PATCH v2 2/6] pmc/uds: Configure the remote server address using the interface API.

2023-12-02 Thread Richard Cochran
The UDS uses a global setting from the configuration to set the remote
server address.  As a result, a program cannot act as both a UDS
client and server, because the source and destination addresses would
be identical.  Fix the issue by allowing the remote address to be
configurable.

Signed-off-by: Richard Cochran 
---
 pmc.c| 6 --
 pmc_agent.c  | 3 ++-
 pmc_common.c | 8 
 pmc_common.h | 6 +++---
 tz2alt.c | 3 ++-
 uds.c| 6 --
 6 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/pmc.c b/pmc.c
index 9faf790..d18fea0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -823,8 +823,10 @@ int main(int argc, char *argv[])
print_set_syslog(1);
print_set_verbose(1);
 
-   pmc = pmc_create(cfg, transport_type, iface_name, boundary_hops,
-domain_number, transport_specific, zero_datalen);
+   pmc = pmc_create(cfg, transport_type, iface_name,
+config_get_string(cfg, NULL, "uds_address"),
+boundary_hops, domain_number, transport_specific,
+zero_datalen);
if (!pmc) {
fprintf(stderr, "failed to create pmc\n");
config_destroy(cfg);
diff --git a/pmc_agent.c b/pmc_agent.c
index 494c174..fec6dea 100644
--- a/pmc_agent.c
+++ b/pmc_agent.c
@@ -232,7 +232,8 @@ int run_pmc_wait_sync(struct pmc_agent *node, int timeout)
 int init_pmc_node(struct config *cfg, struct pmc_agent *node, const char *uds,
  pmc_node_recv_subscribed_t *recv_subscribed, void *context)
 {
-   node->pmc = pmc_create(cfg, TRANS_UDS, uds, 0,
+   node->pmc = pmc_create(cfg, TRANS_UDS, uds,
+  config_get_string(cfg, NULL, "uds_address"), 0,
   config_get_int(cfg, NULL, "domainNumber"),
   config_get_int(cfg, NULL, "transportSpecific") 
<< 4, 1);
if (!node->pmc) {
diff --git a/pmc_common.c b/pmc_common.c
index 5092c09..fca16c6 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -488,9 +488,9 @@ struct pmc {
 };
 
 struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
-  const char *iface_name, UInteger8 boundary_hops,
-  UInteger8 domain_number, UInteger8 transport_specific,
-  int zero_datalen)
+  const char *iface_name, const char *remote_address,
+  UInteger8 boundary_hops, UInteger8 domain_number,
+  UInteger8 transport_specific, int zero_datalen)
 {
struct pmc *pmc;
UInteger32 proc_id;
@@ -524,7 +524,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
goto failed;
}
 
-   pmc->iface = interface_create(iface_name, NULL);
+   pmc->iface = interface_create(iface_name, remote_address);
if (!pmc->iface) {
pr_err("failed to create interface");
goto failed;
diff --git a/pmc_common.h b/pmc_common.h
index 6fb2fae..355b2c0 100644
--- a/pmc_common.h
+++ b/pmc_common.h
@@ -29,9 +29,9 @@
 struct pmc;
 
 struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
-  const char *iface_name, UInteger8 boundary_hops,
-  UInteger8 domain_number, UInteger8 transport_specific,
-  int zero_datalen);
+  const char *iface_name, const char *remote_address,
+  UInteger8 boundary_hops, UInteger8 domain_number,
+  UInteger8 transport_specific, int zero_datalen);
 
 void pmc_destroy(struct pmc *pmc);
 
diff --git a/tz2alt.c b/tz2alt.c
index feb77a5..65b5835 100644
--- a/tz2alt.c
+++ b/tz2alt.c
@@ -181,7 +181,8 @@ static int update_ptp_serivce(struct tzinfo *tz, struct 
tzinfo *next)
struct pmc *pmc;
int err;
 
-   pmc = pmc_create(cfg, TRANS_UDS, uds_local, 0,
+   pmc = pmc_create(cfg, TRANS_UDS, uds_local,
+config_get_string(cfg, NULL, "uds_address"), 0,
 config_get_int(cfg, NULL, "domainNumber"),
 config_get_int(cfg, NULL, "transportSpecific") << 4, 
1);
if (!pmc) {
diff --git a/uds.c b/uds.c
index 6d39dc8..fafb100 100644
--- a/uds.c
+++ b/uds.c
@@ -54,7 +54,7 @@ static int uds_open(struct transport *t, struct interface 
*iface, struct fdarray
enum timestamp_type tt)
 {
char *uds_ro_path = config_get_string(t->cfg, NULL, "uds_ro_address");
-   char *uds_path = config_get_string(t->cfg, NULL, "uds_address");
+   const char *uds_path = interface_remote(iface);
struct uds *uds = container_of(t, struct uds, t);
const char *name = interface_name(iface);
const char* file_mode_cfg;
@@ -8

[Linuxptp-devel] [PATCH v2 3/6] Introduce the Common Mean Link Delay Information TLV.

2023-12-02 Thread Richard Cochran
Add a new TLV to convey link delay measurements by the Common Mean
Link Delay Service (CMLDS) (as specified in IEEE 1588/16.6.3) over the
management interface.

Co-authored-by: Andrew Zaborowski 
Signed-off-by: Kishen Maloor 
Signed-off-by: Richard Cochran 
---
 clock.c  |  1 -
 pmc.c| 11 +++
 pmc_common.c |  1 +
 port.c   |  9 +
 port.h   |  2 ++
 tlv.c| 16 
 tlv.h|  7 +++
 7 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index 6f7722c..c999c83 100644
--- a/clock.c
+++ b/clock.c
@@ -47,7 +47,6 @@
 #include "util.h"
 
 #define N_CLOCK_PFD (N_POLLFD + 1) /* one extra per port, for the fault timer 
*/
-#define POW2_41 ((double)(1ULL << 41))
 
 struct interface {
STAILQ_ENTRY(interface) list;
diff --git a/pmc.c b/pmc.c
index d18fea0..12a6109 100644
--- a/pmc.c
+++ b/pmc.c
@@ -169,6 +169,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
struct subscribe_events_np *sen;
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
+   struct cmlds_info_np *cmlds;
struct timePropertiesDS *tp;
struct management_tlv *mgt;
struct time_status_np *tsn;
@@ -623,6 +624,16 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
pwr->networkTimeInaccuracy,
pwr->totalTimeInaccuracy);
break;
+   case MID_CMLDS_INFO_NP:
+   cmlds = (struct cmlds_info_np *) mgt->data;
+   fprintf(fp, "CMLDS_INFO_NP "
+   IFMT "meanLinkDelay   %" PRId64
+   IFMT "scaledNeighborRateRatio %" PRId32
+   IFMT "as_capable  %" PRIu32,
+   cmlds->meanLinkDelay >> 16,
+   cmlds->scaledNeighborRateRatio,
+   cmlds->as_capable);
+   break;
case MID_LOG_ANNOUNCE_INTERVAL:
mtd = (struct management_tlv_datum *) mgt->data;
fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
diff --git a/pmc_common.c b/pmc_common.c
index fca16c6..1d537f2 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -156,6 +156,7 @@ struct management_id idtab[] = {
{ "UNICAST_MASTER_TABLE_NP", MID_UNICAST_MASTER_TABLE_NP, do_get_action 
},
{ "PORT_HWCLOCK_NP", MID_PORT_HWCLOCK_NP, do_get_action },
{ "POWER_PROFILE_SETTINGS_NP", MID_POWER_PROFILE_SETTINGS_NP, 
do_set_action },
+   { "CMLDS_INFO_NP", MID_CMLDS_INFO_NP, do_get_action },
 };
 
 static void do_get_action(struct pmc *pmc, int action, int index, char *str)
diff --git a/port.c b/port.c
index b7fbfb1..2eca876 100644
--- a/port.c
+++ b/port.c
@@ -883,6 +883,7 @@ static int port_management_fill_response(struct port 
*target,
struct clock_description *desc;
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
+   struct cmlds_info_np *cmlds;
struct management_tlv *tlv;
struct port_stats_np *psn;
struct foreign_clock *fc;
@@ -1125,6 +1126,14 @@ static int port_management_fill_response(struct port 
*target,
memcpy(pwr, >pwr, sizeof(*pwr));
datalen = sizeof(*pwr);
break;
+   case MID_CMLDS_INFO_NP:
+   cmlds = (struct cmlds_info_np *)tlv->data;
+   cmlds->meanLinkDelay = target->peerMeanPathDelay;
+   cmlds->scaledNeighborRateRatio =
+   (Integer32) (target->nrate.ratio * POW2_41 - POW2_41);
+   cmlds->as_capable = target->asCapable;
+   datalen = sizeof(*cmlds);
+   break;
default:
/* The caller should *not* respond to this message. */
tlv_extra_recycle(extra);
diff --git a/port.h b/port.h
index 57c8c2f..cc03859 100644
--- a/port.h
+++ b/port.h
@@ -26,6 +26,8 @@
 #include "notification.h"
 #include "transport.h"
 
+#define POW2_41 ((double)(1ULL << 41))
+
 /* forward declarations */
 struct interface;
 struct clock;
diff --git a/tlv.c b/tlv.c
index 9b82bd9..7cbd84d 100644
--- a/tlv.c
+++ b/tlv.c
@@ -176,6 +176,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t 
data_len,
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
struct timePropertiesDS *tp;
+   struct cmlds_info_np *cmlds;
struct time_status_np *tsn;
struct port_stats_np *psn;
int extra_len = 0, i, len;
@@ -481,6 +482,14 @@ static int mgt_post_recv(struct management_tlv *m, 
uint16_t data_len,
NTOHL(pwr->networkTimeInaccuracy);
NTOHL(pwr->totalTimeInaccuracy);
break;
+   case MID_CMLDS_INFO_NP:
+   if (data_len < sizeof(struct cml

[Linuxptp-devel] [PATCH v2 4/6] Add a push notification for the CMLDS TLV.

2023-12-02 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 notification.h |  1 +
 pmc.c  |  6 --
 pmc_common.c   | 14 ++
 port.c |  7 +++
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/notification.h b/notification.h
index c1a6395..7a8f641 100644
--- a/notification.h
+++ b/notification.h
@@ -45,6 +45,7 @@ enum notification {
NOTIFY_PORT_STATE,
NOTIFY_TIME_SYNC,
NOTIFY_PARENT_DATA_SET,
+   NOTIFY_CMLDS,
 };
 
 #endif
diff --git a/pmc.c b/pmc.c
index 12a6109..6cdd7b0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -453,11 +453,13 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
IFMT "duration   %hu"
IFMT "NOTIFY_PORT_STATE  %s"
IFMT "NOTIFY_TIME_SYNC   %s"
-   IFMT "NOTIFY_PARENT_DATA_SET %s",
+   IFMT "NOTIFY_PARENT_DATA_SET %s"
+   IFMT "NOTIFY_CMLDS   %s",
sen->duration,
event_bitmask_get(sen->bitmask, NOTIFY_PORT_STATE) ? 
"on" : "off",
event_bitmask_get(sen->bitmask, NOTIFY_TIME_SYNC) ? 
"on" : "off",
-   event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off");
+   event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off",
+   event_bitmask_get(sen->bitmask, NOTIFY_CMLDS) ? "on" : 
"off");
break;
case MID_SYNCHRONIZATION_UNCERTAIN_NP:
mtd = (struct management_tlv_datum *) mgt->data;
diff --git a/pmc_common.c b/pmc_common.c
index 1d537f2..a549af5 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -180,6 +180,7 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
char onoff_port_state[4] = "off";
char onoff_time_status[4] = "off";
char onoff_parent_data_set[4] = "off";
+   char onoff_cmlds[4] = "off";
char display_name[11] = {0};
uint64_t jump;
uint8_t key;
@@ -306,13 +307,15 @@ static void do_set_action(struct pmc *pmc, int action, 
int index, char *str)
 "duration  %hu "
 "NOTIFY_PORT_STATE %3s "
 "NOTIFY_TIME_SYNC  %3s "
-"NOTIFY_PARENT_DATA_SET %3s ",
+"NOTIFY_PARENT_DATA_SET %3s "
+"NOTIFY_CMLDS %3s ",
 ,
 onoff_port_state,
 onoff_time_status,
-onoff_parent_data_set);
-   if (cnt != 4) {
-   fprintf(stderr, "%s SET needs 4 values\n",
+onoff_parent_data_set,
+onoff_cmlds);
+   if (cnt != 5) {
+   fprintf(stderr, "%s SET needs 5 values\n",
idtab[index].name);
break;
}
@@ -326,6 +329,9 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
event_bitmask_set(sen.bitmask, NOTIFY_PARENT_DATA_SET,
  TRUE);
}
+   if (!strcasecmp(onoff_cmlds, "on")) {
+   event_bitmask_set(sen.bitmask, NOTIFY_CMLDS, TRUE);
+   }
pmc_send_set_action(pmc, code, , sizeof(sen));
break;
case MID_SYNCHRONIZATION_UNCERTAIN_NP:
diff --git a/port.c b/port.c
index 2eca876..23f021c 100644
--- a/port.c
+++ b/port.c
@@ -748,6 +748,7 @@ capable:
if (p->asCapable == NOT_CAPABLE) {
pr_debug("%s: setting asCapable", p->log_name);
p->asCapable = AS_CAPABLE;
+   port_notify_event(p, NOTIFY_CMLDS);
}
return 1;
 
@@ -755,6 +756,7 @@ not_capable:
if (p->asCapable)
port_nrate_initialize(p);
p->asCapable = NOT_CAPABLE;
+   port_notify_event(p, NOTIFY_CMLDS);
return 0;
 }
 
@@ -2467,6 +2469,8 @@ calc:
 
msg_put(p->peer_delay_req);
p->peer_delay_req = NULL;
+
+   port_notify_event(p, NOTIFY_CMLDS);
 }
 
 int process_pdelay_resp(struct port *p, struct ptp_message *m)
@@ -3264,6 +3268,9 @@ void port_notify_event(struct port *p, enum notification 
event)
case NOTIFY_PORT_STATE:
id = MID_PORT_DATA_SET;
break;
+   case NOTIFY_CMLDS:
+   id = MID_CMLDS_INFO_NP;
+   break;
default:
return;
}
-- 
2.39.2



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


[Linuxptp-devel] [PATCH v2 0/6] Common Mean Link Delay Service (CMLDS)

2023-12-02 Thread Richard Cochran
The CMLDS lets one peer-to-peer delay measurement be shared among
multiple PTP stack instances running on the same host.

To try it, connect the Ethernet ports of two hosts directly:

On one host run CMLDS setup:

   ptp4l -mqf CMLDS_server.cfg
   ptp4l -mqf CMLDS_client.cfg

and on the other host run a normal P2P stack:

   ptp4l -mqi eth1 -P --ignore_transport_specific=1

(The ignore_transport_specific is needed because of the extremely
silly way the majorSdoId aka transportSpecific field is specified in
1588.)


Changes in v2
~
- Added timer to renew push subscription and detect missing server.
- Addressed Andrew and Kishen's review comments.
- Added example configuration files.


Richard Cochran (6):
  interface: Add an optional remote address for use by the UDS
transport.
  pmc/uds: Configure the remote server address using the interface API.
  Introduce the Common Mean Link Delay Information TLV.
  Add a push notification for the CMLDS TLV.
  Implement the COMMON_P2P delay mechanism.
  Add example Common Mean Link Delay Service configuration files.

 clock.c  |   5 +-
 config.c |   8 +-
 configs/CMLDS_client.cfg |  10 ++
 configs/CMLDS_server.cfg |  16 
 configs/default.cfg  |   5 +
 dm.h |   3 +
 fd.h |   1 +
 interface.c  |  12 ++-
 interface.h  |  10 +-
 makefile |   4 +-
 notification.h   |   1 +
 pmc.c|  23 -
 pmc_agent.c  |   3 +-
 pmc_common.c |  23 +++--
 pmc_common.h |   6 +-
 port.c   | 196 ---
 port.h   |   2 +
 port_private.h   |   7 ++
 ptp4l.8  |  35 +++
 tlv.c|  16 
 tlv.h|   7 ++
 tz2alt.c |   3 +-
 uds.c|   6 +-
 23 files changed, 363 insertions(+), 39 deletions(-)
 create mode 100644 configs/CMLDS_client.cfg
 create mode 100644 configs/CMLDS_server.cfg

-- 
2.39.2



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


[Linuxptp-devel] [PATCH v2 1/6] interface: Add an optional remote address for use by the UDS transport.

2023-12-02 Thread Richard Cochran
Because of the implementation of the UDS module, it is not possible
for a process to act as both a PTP management client (PMC) and server.
Going forward, one ptp4l instance will need to subscribe to another
using the PMC methods.  Pave the way by allowing the interface to
include an optional remote UDS address.

Signed-off-by: Richard Cochran 
---
 clock.c  |  4 ++--
 config.c |  2 +-
 interface.c  | 12 ++--
 interface.h  | 10 +-
 pmc_common.c |  2 +-
 5 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/clock.c b/clock.c
index b66dda5..6f7722c 100644
--- a/clock.c
+++ b/clock.c
@@ -1242,7 +1242,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
/* Configure the UDS. */
 
uds_ifname = config_get_string(config, NULL, "uds_address");
-   c->uds_rw_if = interface_create(uds_ifname);
+   c->uds_rw_if = interface_create(uds_ifname, NULL);
if (config_set_section_int(config, interface_name(c->uds_rw_if),
   "announceReceiptTimeout", 0)) {
return NULL;
@@ -1261,7 +1261,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
}
 
uds_ifname = config_get_string(config, NULL, "uds_ro_address");
-   c->uds_ro_if = interface_create(uds_ifname);
+   c->uds_ro_if = interface_create(uds_ifname, NULL);
if (config_set_section_int(config, interface_name(c->uds_ro_if),
   "announceReceiptTimeout", 0)) {
return NULL;
diff --git a/config.c b/config.c
index ad675c8..fe65b76 100644
--- a/config.c
+++ b/config.c
@@ -896,7 +896,7 @@ struct interface *config_create_interface(const char *name, 
struct config *cfg)
return iface;
}
 
-   iface = interface_create(name);
+   iface = interface_create(name, NULL);
if (!iface) {
fprintf(stderr, "cannot allocate memory for a port\n");
return NULL;
diff --git a/interface.c b/interface.c
index 9a83c36..e088e07 100644
--- a/interface.c
+++ b/interface.c
@@ -12,12 +12,13 @@ struct interface {
STAILQ_ENTRY(interface) list;
char name[MAX_IFNAME_SIZE + 1];
char ts_label[MAX_IFNAME_SIZE + 1];
+   char remote[MAX_IFNAME_SIZE + 1];
struct sk_ts_info ts_info;
struct sk_if_info if_info;
int vclock;
 };
 
-struct interface *interface_create(const char *name)
+struct interface *interface_create(const char *name, const char *remote)
 {
struct interface *iface;
 
@@ -27,6 +28,9 @@ struct interface *interface_create(const char *name)
}
strncpy(iface->name, name, MAX_IFNAME_SIZE);
strncpy(iface->ts_label, name, MAX_IFNAME_SIZE);
+   if (remote) {
+   strncpy(iface->remote, remote, MAX_IFNAME_SIZE);
+   }
iface->vclock = -1;
 
return iface;
@@ -57,7 +61,6 @@ bool interface_ifinfo_valid(struct interface *iface)
return iface->if_info.valid ? true : false;
 }
 
-
 const char *interface_name(struct interface *iface)
 {
return iface->name;
@@ -68,6 +71,11 @@ int interface_phc_index(struct interface *iface)
return iface->ts_info.phc_index;
 }
 
+const char *interface_remote(struct interface *iface)
+{
+   return iface->remote;
+}
+
 void interface_set_label(struct interface *iface, const char *label)
 {
strncpy(iface->ts_label, label, MAX_IFNAME_SIZE);
diff --git a/interface.h b/interface.h
index 0873bba..b56adc5 100644
--- a/interface.h
+++ b/interface.h
@@ -23,9 +23,10 @@ struct interface;
 /**
  * Creates an instance of an interface.
  * @param name  The device which indentifies this interface.
+ * @param remote  For UDS interfaces, the address of the remote server, 
possibly NULL.
  * @return  A pointer to an interface instance on success, NULL otherwise.
  */
-struct interface *interface_create(const char *name);
+struct interface *interface_create(const char *name, const char *remote);
 
 /**
  * Destroys an instance of an interface.
@@ -70,6 +71,13 @@ const char *interface_name(struct interface *iface);
  */
 int interface_phc_index(struct interface *iface);
 
+/**
+ * Obtains the remote address from a UDS interface.
+ * @param iface  The interface of interest.
+ * @return   The device name of the network interface.
+ */
+const char *interface_remote(struct interface *iface);
+
 /**
  * Set the time stamping label of a given interface.
  * @param iface  The interface of interest.
diff --git a/pmc_common.c b/pmc_common.c
index 62e34a6..5092c09 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -524,7 +524,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
goto failed;
}
 
-   pmc->iface = interface_create(iface_name);
+   pmc->iface = interface_create(iface_name, NULL);

[Linuxptp-devel] [PATCH v2 6/6] Add example Common Mean Link Delay Service configuration files.

2023-12-02 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 configs/CMLDS_client.cfg | 10 ++
 configs/CMLDS_server.cfg | 16 
 2 files changed, 26 insertions(+)
 create mode 100644 configs/CMLDS_client.cfg
 create mode 100644 configs/CMLDS_server.cfg

diff --git a/configs/CMLDS_client.cfg b/configs/CMLDS_client.cfg
new file mode 100644
index 000..ef10fef
--- /dev/null
+++ b/configs/CMLDS_client.cfg
@@ -0,0 +1,10 @@
+#
+# Common Mean Link Delay Service (CMLDS) example configuration for a
+# CMLDS client, containing those attributes which differ from the
+# defaults.  See the file, default.cfg, for the complete list of
+# available options.
+#
+[global]
+
+[eth1]
+delay_mechanismCOMMON_P2P
diff --git a/configs/CMLDS_server.cfg b/configs/CMLDS_server.cfg
new file mode 100644
index 000..36f118c
--- /dev/null
+++ b/configs/CMLDS_server.cfg
@@ -0,0 +1,16 @@
+#
+# Common Mean Link Delay Service (CMLDS) example configuration for a
+# CMLDS Link Port, containing those attributes which differ from the
+# defaults.  See the file, default.cfg, for the complete list of
+# available options.
+#
+[global]
+clientOnly 1
+clockIdentity  C37D50..00
+free_running   1
+ignore_transport_specific  1
+transportSpecific  2
+uds_address/var/run/cmlds_server
+
+[eth1]
+delay_mechanismP2P
-- 
2.39.2



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


Re: [Linuxptp-devel] [PATCH v1 4/4] phc_ctl: Use util.h NSEC_PER_SEC macro instead of local macro

2023-12-02 Thread Richard Cochran
On Wed, Nov 22, 2023 at 09:36:36AM -0800, Rahul Rameshbabu via Linuxptp-devel 
wrote:
> Use the common NSEC_PER_SEC macro in phc_ctl.
> 
> Signed-off-by: Rahul Rameshbabu 

Series applied, but I fixed up one more NSEC2SEC that was added into
phc_ctl.c since this series was posted.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-12-01 Thread Richard Cochran
On Thu, Nov 30, 2023 at 04:52:44PM -0800, Kishen Maloor wrote:

> CMLDS ptp4l process would be configured with
> transportSpecific/domain=0x2/0.

Question about the spec:

How on earth is this going to work?

I mean, if the link partner is not also using CMLDS, then it won't
reply because of the majorSdoId mismatch.

Does the standard require that either ALL the nodes in a network use
CMLDS, or none do at all?

This is messed up, IMO.

Thanks,
Richard




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


Re: [Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-12-01 Thread Richard Cochran
On Thu, Nov 30, 2023 at 04:52:44PM -0800, Kishen Maloor wrote:

> If serviceMeasurementValid=true, then we set both peer_portid_valid and
> p->nrate.ratio_valid to true so that port_capable() could evaluate to true.

Even simpler: include asCapable from the CMLDS Link Port in the TLV,
and just assign asCapable directly in the cleint.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-11-30 Thread Richard Cochran
On Thu, Nov 30, 2023 at 04:52:44PM -0800, Kishen Maloor wrote:

> > +   p->cmlds_pmc = pmc_create(cfg, TRANS_UDS,
> > + config_get_string(cfg, p->name, 
> > "cmlds_client_address"),
> > + config_get_string(cfg, p->name, 
> > "cmlds_server_address"),
> > + hops,
> > + config_get_int(cfg, NULL, "domainNumber"),
> > + config_get_int(cfg, p->name, 
> > "transportSpecific") << 4,
> 
> I haven't studied the flow here, but using the P2P_COMMON instance's
> transportSpecific and domainNumber above might cause the CMLDS server's
> port_ignore() to drop this message as the
> CMLDS ptp4l process would be configured with
> transportSpecific/domain=0x2/0.
> 
> Perhaps just passing 0x2/0 above will fix things? This is assuming that
> there are no transportSpecific/domainNumber checks on the receive path
> for CMLDS events (which seemed to be the case looking at the code).

Right, those two fields must match.  So I think:

- we'll need options for those two, and

- this is another reason to use a separate pmc instance for cmlds
  rather than reusing the uds port.

> > Right, so the next TODO is to enable FD_DELAY_TIMER for P2P_COMMON
> > mode and let it 1) renew the push subscription and 2) catch the case
> > when the push notification does not arrive on time.
> > 
> 
> Yes, in our series CMLDS queries were performed synchronously at the Pdelay
> request cadence. If serviceMeasurementValid=false then port->pdr_missing was
> incremented and immediately followed by a call to port_capable(). This was
> necessary as I recollect there was a related Avnu test case.
> 
> If serviceMeasurementValid=true, then we set both peer_portid_valid and
> p->nrate.ratio_valid to true so that port_capable() could evaluate to true.

I think that logic can be implemented without any service Measurement
Valid field in the TLV.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-11-30 Thread Richard Cochran
On Thu, Nov 30, 2023 at 07:12:54PM +0100, Andrew Zaborowski wrote:
> On Thu, 30 Nov 2023 at 17:44, Richard Cochran  
> wrote:
> > On Thu, Nov 30, 2023 at 04:32:20PM +0100, Andrew Zaborowski wrote:
> > > > +   PORT_ITEM_STR("cmlds_client_address", "/var/run/cmlds_cleint"),
> > >
> > > I assume the use of this is simply to set unique names for per-port
> > > sockets.  Maybe something like tempnam() could be used instead.
> >
> > No, it has to be under user control, because the path might be under a
> > security policy.
> 
> Do you mean that the user might want it to be under a security policy?

Yes.

>  Otherwise it could be in /tmp.

The top down path has to be the user's choice,
 /tmp/... or
 /var/run/... or
 /whatever/...

and so there must be a configuration option in any case.  It seems
silly to restrict the option to the leading path and not include the
socket file name.

> > > > @@ -1868,6 +1869,33 @@ static void port_clear_fda(struct port *p, int 
> > > > count)
> > > > p->fda.fd[i] = -1;
> > > >  }
> > > >
> > > > +static int port_cmlds_initialize(struct port *p)
> > > > +{
> > > > +   struct config *cfg = clock_config(p->clock);
> > > > +   struct subscribe_events_np sen = {0};
> > > > +   const int zero_datalen = 1;
> > > > +   const UInteger8 hops = 0;
> > > > +
> > > > +   p->cmlds_port = config_get_int(cfg, p->name, "cmlds_port");
> > >
> > > Should this fall back to port_number(p)?
> >
> > I don't see how, since there is always a default for each
> > configuration option.
> 
> Right, it'd need to default to, say, -1 which would be checked here.

Okay, sure.  That will reduce configuration burden for normal setups.

> > Also, I understood from you guys that the port
> > number _has_ to be different to pass compliance tests. For that, I
> > thought adding a "starting port number" option would do the trick
> 
> The port identity (clock identity + port number) has to be unique.  As
> long as the clock identity is unique, which it has to be, I don't
> think the port number *has* to be different.

Got it.

> > serviceMeasurementValid is implicit, because if you get a PUSH
> > notification, it is valid.
> 
> Right, serviceMeasurementValid == true is implicit but
> serviceMeasurementValid == false is useful for the .port_id_valid /
> .pdr_missing logic to work.  The timeout logic is disabled with
> P2P_COMMON.

Right, so the next TODO is to enable FD_DELAY_TIMER for P2P_COMMON
mode and let it 1) renew the push subscription and 2) catch the case
when the push notification does not arrive on time.

Thoughts?

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-11-30 Thread Richard Cochran
On Thu, Nov 30, 2023 at 04:32:20PM +0100, Andrew Zaborowski wrote:

> > @@ -249,6 +250,9 @@ struct config_item config_tab[] = {
> > GLOB_ITEM_INT("clock_class_threshold", 
> > CLOCK_CLASS_THRESHOLD_DEFAULT, 6, CLOCK_CLASS_THRESHOLD_DEFAULT),
> > GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
> > GLOB_ITEM_ENU("clock_type", CLOCK_TYPE_ORDINARY, clock_type_enu),
> > +   PORT_ITEM_STR("cmlds_client_address", "/var/run/cmlds_cleint"),
> 
> I assume the use of this is simply to set unique names for per-port
> sockets.  Maybe something like tempnam() could be used instead.

No, it has to be under user control, because the path might be under a
security policy.
 
> > @@ -1868,6 +1869,33 @@ static void port_clear_fda(struct port *p, int count)
> > p->fda.fd[i] = -1;
> >  }
> >
> > +static int port_cmlds_initialize(struct port *p)
> > +{
> > +   struct config *cfg = clock_config(p->clock);
> > +   struct subscribe_events_np sen = {0};
> > +   const int zero_datalen = 1;
> > +   const UInteger8 hops = 0;
> > +
> > +   p->cmlds_port = config_get_int(cfg, p->name, "cmlds_port");
> 
> Should this fall back to port_number(p)?

I don't see how, since there is always a default for each
configuration option.  Also, I understood from you guys that the port
number _has_ to be different to pass compliance tests. For that, I
thought adding a "starting port number" option would do the trick.
 
> > +   p->cmlds_pmc = pmc_create(cfg, TRANS_UDS,
> > + config_get_string(cfg, p->name, 
> > "cmlds_client_address"),
> > + config_get_string(cfg, p->name, 
> > "cmlds_server_address"),
> > + hops,
> > + config_get_int(cfg, NULL, "domainNumber"),
> > + config_get_int(cfg, p->name, 
> > "transportSpecific") << 4,
> 
> The sdoId is (by either IEEE 1588 or 802.1AS) different for the CMLDS
> than for a P2P_COMMON port, I think a check in port_ignore will
> discard the messages as a result.  Maybe hardcode TS_CMLDS here? (with
> TS_CMLDS defined in msg.h next to TS_IEEE_8021AS)
> 
> Using pmc here surely works but I wonder if it's not actually more
> work than reusing c->uds_port.

I considered that, but I invite you to try implementing that to see
which one is simpler.

> > +   switch (mgt->id) {
> > +   case MID_CMLDS_INFO_NP:
> > +   if (msg->header.sourcePortIdentity.portNumber != 
> > p->cmlds_port) {
> > +   break;
> > +   }
> > +   cmlds = (struct cmlds_info_np *) mgt->data;
> > +   p->peer_delay = nanoseconds_to_tmv(cmlds->meanLinkDelay >> 
> > 16);
> > +   p->peerMeanPathDelay = tmv_to_TimeInterval(p->peer_delay);
> 
> cmlds->meanLinkDelay is already a TimeInterval in case you want to use that.

good point

> > +
> > +   if (p->state == PS_UNCALIBRATED || p->state == PS_SLAVE) {
> > +   const struct timestamp dummy = {0};
> > +   const tmv_t tx = timestamp_to_tmv(dummy);
> 
> tmv_zero() could also be used.

yeah

> > +   clock_peer_delay(p->clock, p->peer_delay, tx, tx,
> > +p->nrate.ratio);
> 
> p->nrate.ratio hasn't been set yet, I think a line similar to this is missing:
> 
> p->nrate.ratio = 1.0 + (double) cmlds->scaledNeighborRateRatio / POW2_41;

Right
 
> The CMLDS port will also need to ensure that the NRR is calculated
> because now it's done conditionally.

Huh, I didn't change that part?
 
> In Kishen's patch series struct cmlds_info_np also had a
> .serviceMeasurementValid which enabled the port_capable() logic to
> work and IIRC that is important at least for 802.1AS compliance.  If
> that was to be re-added, the event would need to be emitted in an
> extra place in the CMLDS, perhaps where pdr_missing is incremented.

serviceMeasurementValid is implicit, because if you get a PUSH
notification, it is valid.

Thanks,
Richard



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


Re: [Linuxptp-devel] [PATCH v1 0/5] Common Mean Link Delay -- proof of concept

2023-11-30 Thread Richard Cochran
On Wed, Nov 29, 2023 at 11:57:16PM -0800, Richard Cochran wrote:
> This is how CMLD should be done, IMHO.

Sample configs...


CMLDS_server.cfg


[global]
clientOnly  1
free_running1
uds_address /var/run/cmlds_server
use_syslog  0
verbose 1

[eth2]
delay_mechanism P2P

[eth1]
delay_mechanism P2P


CMLDS_client.cfg


[global]
use_syslog  0
verbose 1

[eth1]
delay_mechanism COMMON_P2P
cmlds_port  2



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


[Linuxptp-devel] [PATCH v1 4/5] Add a push notification for the CMLDS TLV.

2023-11-30 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 notification.h |  1 +
 pmc.c  |  6 --
 pmc_common.c   | 14 ++
 port.c |  5 +
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/notification.h b/notification.h
index c1a6395..7a8f641 100644
--- a/notification.h
+++ b/notification.h
@@ -45,6 +45,7 @@ enum notification {
NOTIFY_PORT_STATE,
NOTIFY_TIME_SYNC,
NOTIFY_PARENT_DATA_SET,
+   NOTIFY_CMLDS,
 };
 
 #endif
diff --git a/pmc.c b/pmc.c
index c29e3b7..e733cf0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -453,11 +453,13 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
IFMT "duration   %hu"
IFMT "NOTIFY_PORT_STATE  %s"
IFMT "NOTIFY_TIME_SYNC   %s"
-   IFMT "NOTIFY_PARENT_DATA_SET %s",
+   IFMT "NOTIFY_PARENT_DATA_SET %s"
+   IFMT "NOTIFY_CMLDS   %s",
sen->duration,
event_bitmask_get(sen->bitmask, NOTIFY_PORT_STATE) ? 
"on" : "off",
event_bitmask_get(sen->bitmask, NOTIFY_TIME_SYNC) ? 
"on" : "off",
-   event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off");
+   event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off",
+   event_bitmask_get(sen->bitmask, NOTIFY_CMLDS) ? "on" : 
"off");
break;
case MID_SYNCHRONIZATION_UNCERTAIN_NP:
mtd = (struct management_tlv_datum *) mgt->data;
diff --git a/pmc_common.c b/pmc_common.c
index 1d537f2..a549af5 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -180,6 +180,7 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
char onoff_port_state[4] = "off";
char onoff_time_status[4] = "off";
char onoff_parent_data_set[4] = "off";
+   char onoff_cmlds[4] = "off";
char display_name[11] = {0};
uint64_t jump;
uint8_t key;
@@ -306,13 +307,15 @@ static void do_set_action(struct pmc *pmc, int action, 
int index, char *str)
 "duration  %hu "
 "NOTIFY_PORT_STATE %3s "
 "NOTIFY_TIME_SYNC  %3s "
-"NOTIFY_PARENT_DATA_SET %3s ",
+"NOTIFY_PARENT_DATA_SET %3s "
+"NOTIFY_CMLDS %3s ",
 ,
 onoff_port_state,
 onoff_time_status,
-onoff_parent_data_set);
-   if (cnt != 4) {
-   fprintf(stderr, "%s SET needs 4 values\n",
+onoff_parent_data_set,
+onoff_cmlds);
+   if (cnt != 5) {
+   fprintf(stderr, "%s SET needs 5 values\n",
idtab[index].name);
break;
}
@@ -326,6 +329,9 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
event_bitmask_set(sen.bitmask, NOTIFY_PARENT_DATA_SET,
  TRUE);
}
+   if (!strcasecmp(onoff_cmlds, "on")) {
+   event_bitmask_set(sen.bitmask, NOTIFY_CMLDS, TRUE);
+   }
pmc_send_set_action(pmc, code, , sizeof(sen));
break;
case MID_SYNCHRONIZATION_UNCERTAIN_NP:
diff --git a/port.c b/port.c
index aab9d3f..8afe1b2 100644
--- a/port.c
+++ b/port.c
@@ -2466,6 +2466,8 @@ calc:
 
msg_put(p->peer_delay_req);
p->peer_delay_req = NULL;
+
+   port_notify_event(p, NOTIFY_CMLDS);
 }
 
 int process_pdelay_resp(struct port *p, struct ptp_message *m)
@@ -3263,6 +3265,9 @@ void port_notify_event(struct port *p, enum notification 
event)
case NOTIFY_PORT_STATE:
id = MID_PORT_DATA_SET;
break;
+   case NOTIFY_CMLDS:
+   id = MID_CMLDS_INFO_NP;
+   break;
default:
return;
}
-- 
2.39.2



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


[Linuxptp-devel] [PATCH v1 3/5] Introduce the Common Mean Link Delay Information TLV.

2023-11-30 Thread Richard Cochran
Add a new TLV to convey link delay measurements by the Common Mean
Link Delay Service (CMLDS) (as specified in IEEE 1588/16.6.3) over the
management interface.

Co-authored-by: Andrew Zaborowski 
Signed-off-by: Kishen Maloor 
Signed-off-by: Richard Cochran 
---
 clock.c  |  1 -
 pmc.c|  9 +
 pmc_common.c |  1 +
 port.c   |  8 
 port.h   |  2 ++
 tlv.c| 14 ++
 tlv.h|  6 ++
 7 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index 6f7722c..c999c83 100644
--- a/clock.c
+++ b/clock.c
@@ -47,7 +47,6 @@
 #include "util.h"
 
 #define N_CLOCK_PFD (N_POLLFD + 1) /* one extra per port, for the fault timer 
*/
-#define POW2_41 ((double)(1ULL << 41))
 
 struct interface {
STAILQ_ENTRY(interface) list;
diff --git a/pmc.c b/pmc.c
index d18fea0..c29e3b7 100644
--- a/pmc.c
+++ b/pmc.c
@@ -169,6 +169,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
struct subscribe_events_np *sen;
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
+   struct cmlds_info_np *cmlds;
struct timePropertiesDS *tp;
struct management_tlv *mgt;
struct time_status_np *tsn;
@@ -623,6 +624,14 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
pwr->networkTimeInaccuracy,
pwr->totalTimeInaccuracy);
break;
+   case MID_CMLDS_INFO_NP:
+   cmlds = (struct cmlds_info_np *) mgt->data;
+   fprintf(fp, "CMLDS_INFO_NP "
+   IFMT "meanLinkDelay   %" PRId64
+   IFMT "scaledNeighborRateRatio %" PRId32,
+   cmlds->meanLinkDelay >> 16,
+   cmlds->scaledNeighborRateRatio);
+   break;
case MID_LOG_ANNOUNCE_INTERVAL:
mtd = (struct management_tlv_datum *) mgt->data;
fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
diff --git a/pmc_common.c b/pmc_common.c
index fca16c6..1d537f2 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -156,6 +156,7 @@ struct management_id idtab[] = {
{ "UNICAST_MASTER_TABLE_NP", MID_UNICAST_MASTER_TABLE_NP, do_get_action 
},
{ "PORT_HWCLOCK_NP", MID_PORT_HWCLOCK_NP, do_get_action },
{ "POWER_PROFILE_SETTINGS_NP", MID_POWER_PROFILE_SETTINGS_NP, 
do_set_action },
+   { "CMLDS_INFO_NP", MID_CMLDS_INFO_NP, do_get_action },
 };
 
 static void do_get_action(struct pmc *pmc, int action, int index, char *str)
diff --git a/port.c b/port.c
index 136d036..aab9d3f 100644
--- a/port.c
+++ b/port.c
@@ -883,6 +883,7 @@ static int port_management_fill_response(struct port 
*target,
struct clock_description *desc;
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
+   struct cmlds_info_np *cmlds;
struct management_tlv *tlv;
struct port_stats_np *psn;
struct foreign_clock *fc;
@@ -1125,6 +1126,13 @@ static int port_management_fill_response(struct port 
*target,
memcpy(pwr, >pwr, sizeof(*pwr));
datalen = sizeof(*pwr);
break;
+   case MID_CMLDS_INFO_NP:
+   cmlds = (struct cmlds_info_np *)tlv->data;
+   cmlds->meanLinkDelay = target->peerMeanPathDelay;
+   cmlds->scaledNeighborRateRatio =
+   (Integer32) (target->nrate.ratio * POW2_41 - POW2_41);
+   datalen = sizeof(*cmlds);
+   break;
default:
/* The caller should *not* respond to this message. */
tlv_extra_recycle(extra);
diff --git a/port.h b/port.h
index 57c8c2f..cc03859 100644
--- a/port.h
+++ b/port.h
@@ -26,6 +26,8 @@
 #include "notification.h"
 #include "transport.h"
 
+#define POW2_41 ((double)(1ULL << 41))
+
 /* forward declarations */
 struct interface;
 struct clock;
diff --git a/tlv.c b/tlv.c
index 9b82bd9..8fbeb1a 100644
--- a/tlv.c
+++ b/tlv.c
@@ -176,6 +176,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t 
data_len,
struct port_properties_np *ppn;
struct port_hwclock_np *phn;
struct timePropertiesDS *tp;
+   struct cmlds_info_np *cmlds;
struct time_status_np *tsn;
struct port_stats_np *psn;
int extra_len = 0, i, len;
@@ -481,6 +482,13 @@ static int mgt_post_recv(struct management_tlv *m, 
uint16_t data_len,
NTOHL(pwr->networkTimeInaccuracy);
NTOHL(pwr->totalTimeInaccuracy);
break;
+   case MID_CMLDS_INFO_NP:
+   if (data_len < sizeof(struct cmlds_info_np))
+   goto bad_length;
+   cmlds = (struct cmlds_info_np *)m->data;
+   net2host64_unaligned(>meanLinkDelay);
+   NTOHL(cmlds-&

[Linuxptp-devel] [PATCH v1 5/5] Implement the COMMON_P2P delay mechanism.

2023-11-30 Thread Richard Cochran
From: Kishen Maloor 

Signed-off-by: Richard Cochran 
---
 config.c   |   4 ++
 dm.h   |   3 +
 fd.h   |   1 +
 makefile   |   4 +-
 port.c | 166 +++--
 port_private.h |   3 +
 6 files changed, 174 insertions(+), 7 deletions(-)

diff --git a/config.c b/config.c
index fe65b76..05ffd3c 100644
--- a/config.c
+++ b/config.c
@@ -171,6 +171,7 @@ static struct config_enum delay_filter_enu[] = {
 
 static struct config_enum delay_mech_enu[] = {
{ "Auto", DM_AUTO },
+   { "COMMON_P2P", DM_COMMON_P2P },
{ "E2E",  DM_E2E },
{ "P2P",  DM_P2P },
{ "NONE", DM_NO_MECHANISM },
@@ -249,6 +250,9 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("clock_class_threshold", CLOCK_CLASS_THRESHOLD_DEFAULT, 
6, CLOCK_CLASS_THRESHOLD_DEFAULT),
GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
GLOB_ITEM_ENU("clock_type", CLOCK_TYPE_ORDINARY, clock_type_enu),
+   PORT_ITEM_STR("cmlds_client_address", "/var/run/cmlds_cleint"),
+   PORT_ITEM_INT("cmlds_port", 1, 1, UINT16_MAX),
+   PORT_ITEM_STR("cmlds_server_address", "/var/run/cmlds_server"),
GLOB_ITEM_ENU("dataset_comparison", DS_CMP_IEEE1588, dataset_comp_enu),
PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX),
PORT_ITEM_ENU("delay_filter", FILTER_MOVING_MEDIAN, delay_filter_enu),
diff --git a/dm.h b/dm.h
index 47bd847..80d1ce5 100644
--- a/dm.h
+++ b/dm.h
@@ -34,6 +34,9 @@ enum delay_mechanism {
/** Peer delay mechanism. */
DM_P2P,
 
+   /** Peer delay as measured by CMLDS. */
+   DM_COMMON_P2P,
+
/** No Delay Mechanism. */
DM_NO_MECHANISM = 0xFE,
 };
diff --git a/fd.h b/fd.h
index 16420d7..9a072ab 100644
--- a/fd.h
+++ b/fd.h
@@ -39,6 +39,7 @@ enum {
FD_SYNC_TX_TIMER,
FD_UNICAST_REQ_TIMER,
FD_UNICAST_SRV_TIMER,
+   FD_CMLDS,
FD_RTNL,
N_POLLFD,
 };
diff --git a/makefile b/makefile
index 7fc5f6f..e9c1ccc 100644
--- a/makefile
+++ b/makefile
@@ -30,8 +30,8 @@ TS2PHC= ts2phc.o lstab.o nmea.o serial.o sock.o 
ts2phc_generic_pps_source.o \
  ts2phc_nmea_pps_source.o ts2phc_phc_pps_source.o ts2phc_pps_sink.o 
ts2phc_pps_source.o
 OBJ= bmc.o clock.o clockadj.o clockcheck.o config.o designated_fsm.o \
  e2e_tc.o fault.o $(FILTERS) fsm.o hash.o interface.o monitor.o msg.o phc.o \
- port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o $(SERVOS) \
- sk.o stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o unicast_client.o \
+ pmc_common.o port.o port_signaling.o pqueue.o print.o ptp4l.o p2p_tc.o rtnl.o 
\
+ $(SERVOS) sk.o stats.o tc.o $(TRANSP) telecom.o tlv.o tsproc.o 
unicast_client.o \
  unicast_fsm.o unicast_service.o util.o version.o
 
 OBJECTS= $(OBJ) hwstamp_ctl.o nsm.o phc2sys.o phc_ctl.o pmc.o 
pmc_agent.o \
diff --git a/port.c b/port.c
index 8afe1b2..75b4dd8 100644
--- a/port.c
+++ b/port.c
@@ -963,7 +963,8 @@ static int port_management_fill_response(struct port 
*target,
ptp_text_copy(cd->userDescription, >userDescription);
buf += sizeof(struct PTPText) + cd->userDescription->length;
 
-   if (target->delayMechanism == DM_P2P) {
+   if (target->delayMechanism == DM_P2P ||
+   target->delayMechanism == DM_COMMON_P2P) {
memcpy(buf, profile_id_p2p, PROFILE_ID_LEN);
} else {
struct config *cfg = clock_config(target->clock);
@@ -1868,6 +1869,33 @@ static void port_clear_fda(struct port *p, int count)
p->fda.fd[i] = -1;
 }
 
+static int port_cmlds_initialize(struct port *p)
+{
+   struct config *cfg = clock_config(p->clock);
+   struct subscribe_events_np sen = {0};
+   const int zero_datalen = 1;
+   const UInteger8 hops = 0;
+
+   p->cmlds_port = config_get_int(cfg, p->name, "cmlds_port");
+   p->cmlds_pmc = pmc_create(cfg, TRANS_UDS,
+ config_get_string(cfg, p->name, 
"cmlds_client_address"),
+ config_get_string(cfg, p->name, 
"cmlds_server_address"),
+ hops,
+ config_get_int(cfg, NULL, "domainNumber"),
+ config_get_int(cfg, p->name, 
"transportSpecific") << 4,
+ zero_datalen);
+   if (!p->cmlds_pmc) {
+   return -1;
+   }
+
+   event_bitmask_set(sen.bitmask, NOTIFY_CMLDS, TRUE);
+   sen.duration = 3600;
+   p->fda.fd[FD_CMLDS] = pmc_get_transport_fd(p->cmlds_pmc);
+   pmc_send_set_action(p->cm

[Linuxptp-devel] [PATCH v1 0/5] Common Mean Link Delay -- proof of concept

2023-11-30 Thread Richard Cochran
This is how CMLD should be done, IMHO.

Currently, because of the quirks of the UDS module, a program can be a
PMC server or PMC client, but not both.  Patches 1 and 2 address this
issue, allowing ptp4l program to be both a UDS server and client.

Still TODO:

- replace hard coded 1-hour one shot subscription with renewal logic
- man page update for new cmlds options

Please review and test to shake out the bugs.

Thanks,
Richard


Kishen Maloor (1):
  Implement the COMMON_P2P delay mechanism.

Richard Cochran (4):
  interface: Add an optional remote address for use by the UDS transport.
  pmc/uds: Configure the remote server address using the interface API.
  Introduce the Common Mean Link Delay Information TLV.
  Add a push notification for the CMLDS TLV.

 clock.c|   5 +-
 config.c   |   6 +-
 dm.h   |   3 +
 fd.h   |   1 +
 interface.c|  12 +++-
 interface.h|  10 ++-
 makefile   |   4 +-
 notification.h |   1 +
 pmc.c  |  21 --
 pmc_agent.c|   3 +-
 pmc_common.c   |  23 ---
 pmc_common.h   |   6 +-
 port.c | 179 +++--
 port.h |   2 +
 port_private.h |   3 +
 tlv.c  |  14 
 tlv.h  |   6 ++
 tz2alt.c   |   3 +-
 uds.c  |   6 +-
 19 files changed, 275 insertions(+), 33 deletions(-)

-- 
2.39.2



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


[Linuxptp-devel] [PATCH v1 2/5] pmc/uds: Configure the remote server address using the interface API.

2023-11-30 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 pmc.c| 6 --
 pmc_agent.c  | 3 ++-
 pmc_common.c | 8 
 pmc_common.h | 6 +++---
 tz2alt.c | 3 ++-
 uds.c| 6 --
 6 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/pmc.c b/pmc.c
index 9faf790..d18fea0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -823,8 +823,10 @@ int main(int argc, char *argv[])
print_set_syslog(1);
print_set_verbose(1);
 
-   pmc = pmc_create(cfg, transport_type, iface_name, boundary_hops,
-domain_number, transport_specific, zero_datalen);
+   pmc = pmc_create(cfg, transport_type, iface_name,
+config_get_string(cfg, NULL, "uds_address"),
+boundary_hops, domain_number, transport_specific,
+zero_datalen);
if (!pmc) {
fprintf(stderr, "failed to create pmc\n");
config_destroy(cfg);
diff --git a/pmc_agent.c b/pmc_agent.c
index 494c174..fec6dea 100644
--- a/pmc_agent.c
+++ b/pmc_agent.c
@@ -232,7 +232,8 @@ int run_pmc_wait_sync(struct pmc_agent *node, int timeout)
 int init_pmc_node(struct config *cfg, struct pmc_agent *node, const char *uds,
  pmc_node_recv_subscribed_t *recv_subscribed, void *context)
 {
-   node->pmc = pmc_create(cfg, TRANS_UDS, uds, 0,
+   node->pmc = pmc_create(cfg, TRANS_UDS, uds,
+  config_get_string(cfg, NULL, "uds_address"), 0,
   config_get_int(cfg, NULL, "domainNumber"),
   config_get_int(cfg, NULL, "transportSpecific") 
<< 4, 1);
if (!node->pmc) {
diff --git a/pmc_common.c b/pmc_common.c
index 5092c09..fca16c6 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -488,9 +488,9 @@ struct pmc {
 };
 
 struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
-  const char *iface_name, UInteger8 boundary_hops,
-  UInteger8 domain_number, UInteger8 transport_specific,
-  int zero_datalen)
+  const char *iface_name, const char *remote_address,
+  UInteger8 boundary_hops, UInteger8 domain_number,
+  UInteger8 transport_specific, int zero_datalen)
 {
struct pmc *pmc;
UInteger32 proc_id;
@@ -524,7 +524,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
goto failed;
}
 
-   pmc->iface = interface_create(iface_name, NULL);
+   pmc->iface = interface_create(iface_name, remote_address);
if (!pmc->iface) {
pr_err("failed to create interface");
goto failed;
diff --git a/pmc_common.h b/pmc_common.h
index 6fb2fae..355b2c0 100644
--- a/pmc_common.h
+++ b/pmc_common.h
@@ -29,9 +29,9 @@
 struct pmc;
 
 struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type,
-  const char *iface_name, UInteger8 boundary_hops,
-  UInteger8 domain_number, UInteger8 transport_specific,
-  int zero_datalen);
+  const char *iface_name, const char *remote_address,
+  UInteger8 boundary_hops, UInteger8 domain_number,
+  UInteger8 transport_specific, int zero_datalen);
 
 void pmc_destroy(struct pmc *pmc);
 
diff --git a/tz2alt.c b/tz2alt.c
index feb77a5..65b5835 100644
--- a/tz2alt.c
+++ b/tz2alt.c
@@ -181,7 +181,8 @@ static int update_ptp_serivce(struct tzinfo *tz, struct 
tzinfo *next)
struct pmc *pmc;
int err;
 
-   pmc = pmc_create(cfg, TRANS_UDS, uds_local, 0,
+   pmc = pmc_create(cfg, TRANS_UDS, uds_local,
+config_get_string(cfg, NULL, "uds_address"), 0,
 config_get_int(cfg, NULL, "domainNumber"),
 config_get_int(cfg, NULL, "transportSpecific") << 4, 
1);
if (!pmc) {
diff --git a/uds.c b/uds.c
index 6d39dc8..fafb100 100644
--- a/uds.c
+++ b/uds.c
@@ -54,7 +54,7 @@ static int uds_open(struct transport *t, struct interface 
*iface, struct fdarray
enum timestamp_type tt)
 {
char *uds_ro_path = config_get_string(t->cfg, NULL, "uds_ro_address");
-   char *uds_path = config_get_string(t->cfg, NULL, "uds_address");
+   const char *uds_path = interface_remote(iface);
struct uds *uds = container_of(t, struct uds, t);
const char *name = interface_name(iface);
const char* file_mode_cfg;
@@ -89,7 +89,9 @@ static int uds_open(struct transport *t, struct interface 
*iface, struct fdarray
/* For client use, pre load the server path. */
memset(, 0, sizeof(sa));
sa.sun_family = AF_LOCAL;
-   strncpy(sa.sun_path, uds_path, sizeof(sa.sun_path) - 1);
+  

[Linuxptp-devel] [PATCH v1 1/5] interface: Add an optional remote address for use by the UDS transport.

2023-11-30 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 clock.c  |  4 ++--
 config.c |  2 +-
 interface.c  | 12 ++--
 interface.h  | 10 +-
 pmc_common.c |  2 +-
 5 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/clock.c b/clock.c
index b66dda5..6f7722c 100644
--- a/clock.c
+++ b/clock.c
@@ -1242,7 +1242,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
/* Configure the UDS. */
 
uds_ifname = config_get_string(config, NULL, "uds_address");
-   c->uds_rw_if = interface_create(uds_ifname);
+   c->uds_rw_if = interface_create(uds_ifname, NULL);
if (config_set_section_int(config, interface_name(c->uds_rw_if),
   "announceReceiptTimeout", 0)) {
return NULL;
@@ -1261,7 +1261,7 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
}
 
uds_ifname = config_get_string(config, NULL, "uds_ro_address");
-   c->uds_ro_if = interface_create(uds_ifname);
+   c->uds_ro_if = interface_create(uds_ifname, NULL);
if (config_set_section_int(config, interface_name(c->uds_ro_if),
   "announceReceiptTimeout", 0)) {
return NULL;
diff --git a/config.c b/config.c
index ad675c8..fe65b76 100644
--- a/config.c
+++ b/config.c
@@ -896,7 +896,7 @@ struct interface *config_create_interface(const char *name, 
struct config *cfg)
return iface;
}
 
-   iface = interface_create(name);
+   iface = interface_create(name, NULL);
if (!iface) {
fprintf(stderr, "cannot allocate memory for a port\n");
return NULL;
diff --git a/interface.c b/interface.c
index 9a83c36..e088e07 100644
--- a/interface.c
+++ b/interface.c
@@ -12,12 +12,13 @@ struct interface {
STAILQ_ENTRY(interface) list;
char name[MAX_IFNAME_SIZE + 1];
char ts_label[MAX_IFNAME_SIZE + 1];
+   char remote[MAX_IFNAME_SIZE + 1];
struct sk_ts_info ts_info;
struct sk_if_info if_info;
int vclock;
 };
 
-struct interface *interface_create(const char *name)
+struct interface *interface_create(const char *name, const char *remote)
 {
struct interface *iface;
 
@@ -27,6 +28,9 @@ struct interface *interface_create(const char *name)
}
strncpy(iface->name, name, MAX_IFNAME_SIZE);
strncpy(iface->ts_label, name, MAX_IFNAME_SIZE);
+   if (remote) {
+   strncpy(iface->remote, remote, MAX_IFNAME_SIZE);
+   }
iface->vclock = -1;
 
return iface;
@@ -57,7 +61,6 @@ bool interface_ifinfo_valid(struct interface *iface)
return iface->if_info.valid ? true : false;
 }
 
-
 const char *interface_name(struct interface *iface)
 {
return iface->name;
@@ -68,6 +71,11 @@ int interface_phc_index(struct interface *iface)
return iface->ts_info.phc_index;
 }
 
+const char *interface_remote(struct interface *iface)
+{
+   return iface->remote;
+}
+
 void interface_set_label(struct interface *iface, const char *label)
 {
strncpy(iface->ts_label, label, MAX_IFNAME_SIZE);
diff --git a/interface.h b/interface.h
index 0873bba..b56adc5 100644
--- a/interface.h
+++ b/interface.h
@@ -23,9 +23,10 @@ struct interface;
 /**
  * Creates an instance of an interface.
  * @param name  The device which indentifies this interface.
+ * @param remote  For UDS interfaces, the address of the remote server, 
possibly NULL.
  * @return  A pointer to an interface instance on success, NULL otherwise.
  */
-struct interface *interface_create(const char *name);
+struct interface *interface_create(const char *name, const char *remote);
 
 /**
  * Destroys an instance of an interface.
@@ -70,6 +71,13 @@ const char *interface_name(struct interface *iface);
  */
 int interface_phc_index(struct interface *iface);
 
+/**
+ * Obtains the remote address from a UDS interface.
+ * @param iface  The interface of interest.
+ * @return   The device name of the network interface.
+ */
+const char *interface_remote(struct interface *iface);
+
 /**
  * Set the time stamping label of a given interface.
  * @param iface  The interface of interest.
diff --git a/pmc_common.c b/pmc_common.c
index 62e34a6..5092c09 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -524,7 +524,7 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
goto failed;
}
 
-   pmc->iface = interface_create(iface_name);
+   pmc->iface = interface_create(iface_name, NULL);
if (!pmc->iface) {
pr_err("failed to create interface");
goto failed;
-- 
2.39.2



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


Re: [Linuxptp-devel] [PATCH v2] Add support for DELAY_REQ and SYNC packets RX filters

2023-11-28 Thread Richard Cochran
On Tue, Nov 28, 2023 at 12:53:38PM +0100, Miroslav Lichvar wrote:
> On Sun, Nov 26, 2023 at 11:10:05AM -0800, Richard Cochran wrote:
> > The Rx filters are applied globally at the device level, but the PTP
> > operates at the application level.  This means that the Rx filter are
> > shared between applications.  And so you can see that one application
> > cannot simply change the shared global settings at run time.
> 
> This problem already exists, e.g. with ptpv2-l4-event vs ptpv2-l2-event.

That is totally different.  As long as the HW supports the given
transport, then it works.

> If the
> hardware which cannot timestamp all event messages is very rare, ok,
> maybe it's not worth the trouble.

And it simply cannot work in real life.

> However, timestamping only sync messages has an advantage with very
> large number of clients as they don't have timestamp each other's
> delay requets and timestamping of sync messages is more reliable.

Actually, in hardware is it much simpler and more efficient just to
time stamp every frame.  (The reporting can be selectable if the
application doesn't care about some frame types)


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


Re: [Linuxptp-devel] [PATCH v2] Add support for DELAY_REQ and SYNC packets RX filters

2023-11-27 Thread Richard Cochran
On Mon, Nov 27, 2023 at 10:47:48AM +0300, IlorDash wrote:
> Thanks, Richard, for such a detailed answer!
> I'll try to find another solution to handle it.

You can always keep your patches for your custom build.  After all, it
is open source, free for you to adapt.  But I don't want to include
those changes in the main project code base.

Thanks,
Richard



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


Re: [Linuxptp-devel] [PATCH] Add scaledLastGmFreqChange computation

2023-11-27 Thread Richard Cochran
On Mon, Nov 27, 2023 at 10:20:56AM +0100, Erez wrote:
> It is public if you change the printed name in PMC.

You mean scripts that invoke pmc?

Yeah, that could cause users' setups to break.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH 0/2] Enhanced Handling of Multiple Pdelay Responses

2023-11-26 Thread Richard Cochran
On Wed, Nov 08, 2023 at 03:14:04AM +0800, Chwee-Lin Choong wrote:
> The patches aim to enhance the handling of multiple pdelay responses. 
> These improvements are aligned with both IEEE 802.1AS-2011 and 
> IEEE 802.1AS-2020 standards.
> 
> The first patch introduces configurability for 'allowedLostResponses' 
> as a per-port parameter. This adjustment aligns with IEEE 802.1AS-2020 
> standards, which specify a default value of 9 while allowing a range 
> of values from 1 to 255.
> 
> The second patch refines the detection and management of multiple 
> pdelay responses, whether from the same peer or distinct peers.
> These refinements ensure that the handling of multiple pdelay responses
> is now based on the 'allowedLostResponses' threshold.
> 
> These modifications have been validated following  Avnu Alliance
> Test Plan for '802.1AS Time Synchronization'
> 
> Kishen Maloor (1):
>   Make allowedLostResponses configurable
> 
> Chwee-Lin Choong (1):
>   port: Fix multiple pdelay response handling

Series applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] Add scaledLastGmFreqChange computation

2023-11-26 Thread Richard Cochran
On Thu, Nov 23, 2023 at 01:39:45PM +0100, Erez wrote:
> On Thu, 23 Nov 2023 at 04:26, Chwee-Lin Choong 
> wrote:
> 
> > Add the computation for scaledLastGmFreqChange, as specified in
> > IEEE 802.1AS-2020, clause 11.4.4.3.9. This incorporates the
> > necessary logic to calculate scaledLastGmFreqChange and
> > appends the result to the follow-up TLV.
> >
> > In addition, a naming error has been rectified from
> > scaledLastGmPhaseChange to scaledLastGmFreqChange.
> >
> 
> It might be an error, but we do not change a public API.
> As some users might depend on it.

No, this does not break an API/ABI.  The name of a field in a header
file is a C language identifier, and it does not exist at run time.

(Changing the size, type, or position of a field, now THAT would break
the ABI)

Thanks,
Richard



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


Re: [Linuxptp-devel] [PATCH v4 2/2] ptp4l: Allow advertisement of legacy PTP 2.0 protocol

2023-11-26 Thread Richard Cochran
On Fri, Nov 10, 2023 at 06:46:57PM +0100, Maciek Machnikowski wrote:
> Some hardware can't properly timestamp packets with the new PTP
> header version 2.1. This patch adds legacy_ptp_ver config option that
> allows advertising of the legacy 2.0 protocol.
> 
> Additionally, forcing PTP minor version to be nonzero causes
> interoperability issues with some legacy grandmasters.
> 
> v2: rebase on top, clarify compatibility issues
> v3: fix subject line
> v4: change argument to ptp_minor_version
> 
> Signed-off-by: Maciek Machnikowski 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v4 1/2] msg: Enable changing PTP message header version

2023-11-26 Thread Richard Cochran
On Fri, Nov 10, 2023 at 06:46:56PM +0100, Maciek Machnikowski wrote:
> Some hardware can't properly timestamp packets with the new PTP
> header version 2.1. This patch introduces a global var ptp_hdr_ver
> that can be changed externally to allow legacy PTP version to be
> advertised.
> 
> Forcing 2.1 also breaks interoperability with some older
> grandmasters which will ignore packets with ptp_minor version set.
> 
> v2: clarify compatibility issue caused by the change
> v3: fix subject line
> 
> Signed-off-by: Maciek Machnikowski 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH 0/1] Support for Port level Perforamnce Monitoring Counters

2023-11-26 Thread Richard Cochran
On Mon, Nov 13, 2023 at 02:38:19PM +0100, Erez wrote:
> I think Richard means using the SUBSCRIBE_EVENTS_NP.

Yes.

> Adding new events, and make sure the ptp4l sends all the statistics you
> need together.

Yes, but please don't "overload" the existing counters.  Just add new
fields with names that identify the kind of event that is being
counted.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2 2/2] linuxptp: Use ${CC} in incdefs.sh

2023-11-26 Thread Richard Cochran
On Mon, Oct 23, 2023 at 10:43:43AM +0100, Luca Fancellu wrote:
> The Makefile is defining CC and incdefs.sh is using
> ${CROSS_COMPILE}cpp inside it, allowing both to use different
> compilers depending on what the user pass during make invocation
> as CC.
> 
> Align them using ${CC} also inside incdefs.sh.
> 
> Signed-off-by: Luca Fancellu 
> ---
> Changes from v1:
>  - The ${CC} variable inside incdefs.sh was taken from the environment, so in
>the Makefile, pass the same CC as environment variable to the script making
>sure the value is truly aligned. (pointed out by Erez)

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2 1/2] include string.h for strncpy()

2023-11-26 Thread Richard Cochran
On Mon, Oct 23, 2023 at 10:43:42AM +0100, Luca Fancellu wrote:
> From: Khem Raj 
> 
> Signed-off-by: Khem Raj 
> ---
> Changes from v1:
>  - no changes
> ---
>  interface.c | 1 +
>  1 file changed, 1 insertion(+)

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2] Add support for DELAY_REQ and SYNC packets RX filters

2023-11-26 Thread Richard Cochran
On Sun, Nov 26, 2023 at 01:38:15PM +0300, IlorDash wrote:
> Could you, please, explain why you think my hardware is broken? I thought,
> since SYNC and DELAY_REQ filters are defined in Linux, ptp4l can use them
> to set type-specific hardware filters.

Here is another reason why:

The Rx filters are applied globally at the device level, but the PTP
operates at the application level.  This means that the Rx filter are
shared between applications.  And so you can see that one application
cannot simply change the shared global settings at run time.

For example, multiple ptp4l instances running different PTP Domains on
the same network interface using virtual PHCs will have different port
roles at the same time.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2] Add support for DELAY_REQ and SYNC packets RX filters

2023-11-26 Thread Richard Cochran
On Sun, Nov 26, 2023 at 01:38:15PM +0300, IlorDash wrote:
> Could you, please, explain why you think my hardware is broken? I thought,
> since SYNC and DELAY_REQ filters are defined in Linux, ptp4l can use them
> to set type-specific hardware filters.

The port role can and will suddenly change at run time.  Therefore the
hardware must time stamp all PTP event messages.  Otherwise you have a
race condition that cannot be solved.

The only hardware I ever saw with this defective design was the IXP
465.  That was fifteen years ago.  Even at that time, it was clear
that the hardware design will not work in real life.  I thought that
vendors learned from their mistake, because that design quickly
went EOL.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2] Add support for DELAY_REQ and SYNC packets RX filters

2023-11-25 Thread Richard Cochran
On Fri, Nov 24, 2023 at 10:29:12PM +0300, IlorDash wrote:
> From: Ilya Orazov 
> 
> I’m using an Ethernet controller with PTP support, which requires
> determining which PTP packets on RX must be timestamped: SYNC or
> DELAY_REQ, based on whether the device is Slave or Master respectively.
> So I can’t use the EVENT RX filter and must dynamically switch RX
> filters, when port state changes from Master to Slave and vice versa.

NAK, we don't support broken hardware.

Thanks,

Richard


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


Re: [Linuxptp-devel] [PATCH v2] lstab: Update leapfile validity

2023-11-21 Thread Richard Cochran
On Tue, Nov 21, 2023 at 11:04:48AM +0100, Maciek Machnikowski wrote:
> No leap seconds will happen till 28 June 2024. Update leapfile validity
> accordingly.
> Add a new source of leapsecond file from the IERS.
> 
> v2: Removed obsolete links
> 
> Signed-off-by: Maciek Machnikowski 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] print: Support log level in message tag.

2023-11-21 Thread Richard Cochran
On Tue, Nov 14, 2023 at 04:23:26PM +0100, Miroslav Lichvar wrote:
> If the string specified by the message_tag option contains "{level}",
> replace it with the log level of the message as a number.
> 
> This allows users to filter printed log messages by their level.
> 
> Signed-off-by: Miroslav Lichvar 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2 0/4] Handle unresponsive ptp4l in phc2sys

2023-11-21 Thread Richard Cochran
On Tue, Nov 14, 2023 at 01:18:58PM +0100, Miroslav Lichvar wrote:
> v2:
> - changed pmc_agent_subscribe() to accept update interval instead of
>   subscription duration to simplify the code and keep constants in one place
> - reordered and merged patches to better follow the previous change
> - improved coding style per suggestions
> 
> This series improves the automatic mode of phc2sys to handle
> unresponsive ptp4l, e.g. stopped, crashed or accidentaly removed socket.
> The first three patches prepare the code for the actual handling
> implemented in the fifth patch.

fourth ;^)

> Miroslav Lichvar (4):
>   pmc_agent: Add function to check if still subscribed.
>   pmc_agent: Make update interval configurable.
>   phc2sys: Better indicate domain with realtime clock.
>   phc2sys: Stop synchronization when ptp4l stops responding.

Series applied.

Thanks,
Richard



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


Re: [Linuxptp-devel] [PATCH 1/1] port: set_tmo_log() timer interval calculation fix

2023-11-21 Thread Richard Cochran
On Tue, Oct 10, 2023 at 12:29:22PM +0200, Paweł Modrzejewski wrote:
> Make it possible to set timeout values bigger than 2.147 sec
> and print error message in case port_set_sync_rx_tmo() fails.
> 
> Signed-off-by: Paweł Modrzejewski 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] Add notification for changes in PARENT_DATA_SET.

2023-11-21 Thread Richard Cochran
On Mon, Jun 26, 2023 at 05:16:20PM +0200, Miroslav Lichvar wrote:
> Add a new notification event for pmc clients to receive
> PARENT_DATA_SET when a change is made there.
> 
> Signed-off-by: Miroslav Lichvar 

Applied.

linuxptp-testsuite test 20-pmc now fails with

  "SUBSCRIBE_EVENTS_NP SET needs 4 values"

Can you provide an update?

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH 2/4] unicast: Add function to query if delay response granted for best master

2023-11-21 Thread Richard Cochran
Vincent,

Sorry for the VERY long delay in reviewing your patches...

On Mon, Mar 13, 2023 at 11:22:25PM -0400, Vincent Cheng wrote:

> +int unicast_client_delay_response_granted(struct port *p)
> +{
> + struct unicast_master_address *ucma;
> +
> + if (!unicast_client_enabled(p)) {
> + return 1;

Should this return zero instead?

The Doxygen comment says:

 @return One (1) if a unicast client and deslay response was granted for 
p->best
 or zero otherwise.

So I'm confused...

Thanks,

Richard


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


Re: [Linuxptp-devel] port immediately enters faulty state

2023-11-17 Thread Richard Cochran
On Fri, Nov 17, 2023 at 03:29:16PM -0800, Cliff Spradlin via Linuxptp-devel 
wrote:
> I'm investigating why a port immediately enters a faulty state on
> startup (and then self-recovers).
> 
> It looks like there might be some buggy rtnl logic.

This sounds familiar... wasn't there a bug in this area?
Are you on the latest sha?

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-17 Thread Richard Cochran
On Fri, Nov 17, 2023 at 08:27:43PM -0800, Richard Cochran wrote:
> How does this requirement improve synchronization?
> 
> What benefit does it bring to users of the PTP?

rhetorical questions  :^(


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-17 Thread Richard Cochran
On Fri, Nov 17, 2023 at 01:51:18PM +0100, Andrew Zaborowski wrote:

> It is exposed on the wire in the Pdelay messages.  Compliance tests
> look at this.  They also simulate a few hypothetical scenarios like a
> domain 0 PTP port trying to communicate with a CMLDS link port since
> 1588 talks about this.

How does this requirement improve synchronization?

What benefit does it bring to users of the PTP?

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-16 Thread Richard Cochran
On Fri, Nov 17, 2023 at 01:41:19AM +0100, Andrew Zaborowski wrote:
> On Thu, 16 Nov 2023 at 23:46, Richard Cochran  
> wrote:
> > No, I mean the PTP port number.  These are taken from the order of the
> > interfaces on the command line and in the configuration file.
> 
> Won't this be the same as the UDS message's sourcePortIdentity.portNumber?

Ah, yes, you are right.  Even simpler!

> Do you want to require the user to enforce that the port numbering is
> the same between the ptp4l processes?

No.

> In our use case spec compliance
> is the priority, including the unique clockIdentity for CMLDS
> requirement, so we'd definitely need to be running a separate ptp4l
> process for CMLDS in this schema.

The clockIdentity is not exposed, so what do you mean by "compliance"?

> I'm asking because the port
> numbering thing is unobvious and the user effort to configure a
> compliant setup with ptp4l is already very high.

That is just par for the course.  I'm not the one making up tons of
crazy new options.

The strength of linuxptp is modularity and fine grained, configurable
options.  This means that a) ptp4l works even with equipment that
fails to follow the standards and/or profiles, and b) ptp4l can be
really hard to configure.

> So one solution would be to let the user configure a custom portNumber
> under port settings.

Port numbers start with 1 and increase in the order of the configured
interfaces.  If it really is required for CMLDS ports to have
*different* numbers than the normal ports, we can add a "port index
offset" option that would start the numbering at some given value.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-16 Thread Richard Cochran
On Thu, Nov 16, 2023 at 11:11:50PM +0100, Andrew Zaborowski wrote:

> The two timestamps are passed to clock_peer_delay() by the receiving
> port and stored in c->tsproc.  Then they're accessed by
> get_raw_delay() which is used in the filter logic.  I'm not sure how
> much value that has, we can possibly pass 0s to clock_peer_delay().

If the client uses CMLDS, then it doesn't need tsproc logic at all.
It simply take the delay value from the CMLDS server.
 
> Regarding "source_port_index", I assume that would contain the ifindex
> of the interface?  With virtual clocks I believe the PHC indices may
> differ between the PTP ports on one physical port ("link port").

No, I mean the PTP port number.  These are taken from the order of the
interfaces on the command line and in the configuration file.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] Problem: Under GNSS error condition/fluctuation, ts2phc updating 1sec time into PHC resulting in wrong time.

2023-11-16 Thread Richard Cochran
On Thu, Nov 16, 2023 at 10:42:33AM +, ramesh t wrote:

> Under GNSS fluctuation condition due bad weather or improper
> location of GNSS antenna, observed ts2phc process updates 1 sec
> difference into the physical hard clock (PHC) of the NIC.  This 1
> sec jump is seen momentarily as captured below.

What is the root cause of the one second offset?

You need to identify the problem.  This issue sounds like a bug in the
GNSS radio firmware.  It does not seem like a bug in linuxptp.

I don't take patches that work around buggy third party equipment!

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v4 0/4] add get_pins_cfg command to display pin functions

2023-11-15 Thread Richard Cochran
On Mon, Jun 26, 2023 at 12:03:29PM -0700, Jacob Keller wrote:
> Extend phc_ctl with a new get_pins_cfg command which calls the
> PTP_PIN_GETFUNC ioctl on a PHC clock and prints the pin configuration for
> each pin.
> 
> Changes since v3:
> * remove use of PTP_PIN_SETFUNC2 and PTP_PIN_GETFUNC2 at Erez's request
> * avoid converting PTP_PF_NONE in pin_func_string()
> * check clkid >= 0 instead of clkid == CLOCK_REALTIME
> * add a patch to do the same clkid check in do_caps()

Jacob,

Sorry for the delay.  I wanted to merge this series, but there is a
conflict.  Can you fix it up in a v5?

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-15 Thread Richard Cochran
On Wed, Nov 15, 2023 at 09:45:52PM -0800, Richard Cochran wrote:
> On Mon, May 15, 2023 at 06:26:04PM -0400, Kishen Maloor wrote:
> 
> > @@ -473,6 +476,14 @@ struct msg_interface_rate_tlv {
> > UInteger16numberOfBitsAfterTimestamp;
> >  } PACKED;
> >  
> > +struct cmlds_info_np {
> > +   Integer8 serviceMeasurementValid;
> > +   TimeInterval meanLinkDelay;
> > +   Integer32scaledNeighborRateRatio;
> 
> I think you need one more field, like "source_port_index"
> 
> If a client subscribes to TLVs from multiple ports, then it needs a
> way to tell which is which.

Or maybe the subscription will cause the CMLDS server to forward all
p2p delay measurements from all p2p ports.

Still the TLVs needs to include the port index.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 4/9] Update the PdelayReq/Res flows for CMLDS Link Ports

2023-11-15 Thread Richard Cochran
On Wed, Nov 15, 2023 at 08:58:58PM -0800, Richard Cochran wrote:
> The text of 1588 strongly suggests that the CMLDS service be stand
> alone daemon.  However, we can provide the same functionality without
> the extra complexity, by simply letting ptp4l serve the measured peer
> delay to any local client.

And, if you _really_ want to have a stand alone CMLDS server with its
own clockIdentity etc, then that is easy:

ptp4l \
--clientOnly=1 \
--clockIdentity=10.2000.30 \
--domainNumber=0 \
--free_running=1 \
--delay_mechanism=P2P \
-i eth0

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:04PM -0400, Kishen Maloor wrote:

> @@ -473,6 +476,14 @@ struct msg_interface_rate_tlv {
> UInteger16numberOfBitsAfterTimestamp;
>  } PACKED;
>  
> +struct cmlds_info_np {
> + Integer8 serviceMeasurementValid;
> + TimeInterval meanLinkDelay;
> + Integer32scaledNeighborRateRatio;

I think you need one more field, like "source_port_index"

If a client subscribes to TLVs from multiple ports, then it needs a
way to tell which is which.

> + Integer64egress_ts;
> + Integer64rx_ts;
> +} PACKED;

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 6/9] Add plumbing for interacting with the CMLDS

2023-11-15 Thread Richard Cochran
On Wed, Nov 15, 2023 at 09:05:45PM -0800, Richard Cochran wrote:

> I'd like to have this:
> 
> 1. provide the new TLV via the PUSH mechanism.
> 
> 2. let clients using DM_COMMON_P2P subscribe to the new TLV.
> 
> 3. let the client update their peer delay values based on an incoming TLV.

For clients to do this, maybe the cleanest way is to add a new UDS
client FD into the 'struct fdarray' (see fd.h)

Thanks,
Richard


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


Re: [Linuxptp-devel] CMLDS Patches

2023-11-15 Thread Richard Cochran
On Mon, Aug 21, 2023 at 10:44:27AM +0200, Walfred Tedeschi wrote:
> On 11.08.23 19:13, Richard Cochran wrote:
> > The CMLDS series will require careful review.  My superficial review
> > gave me the impression that the approach was too complex.
> Do you have an indication on how it could be simplified?

I commented on the v2 patch series just now.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 4/9] Update the PdelayReq/Res flows for CMLDS Link Ports

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:07PM -0400, Kishen Maloor wrote:

> For ports that are configured with "run_cmlds=1", i.e. CMLDS Link
> Ports, this change updates port_pdelay_request(), process_pdelay_req() and
> port_peer_delay() to utilize the CMLDS sdoid/domainNumber/portId
> along code paths where necessary.

We already have options to configure those attributes.  The use can
simply configure the port that will do the p2p measurement
accordingly.

> It also ensures that
> neighborRateRatio is calculated on CMLDS Link Ports and is available
> to users of MID_CMLDS_INFO_NP. Further, process_pdelay_request()
> enforces two-step Pdelay when responding as CMLDS.

Again, we already have a way to configure this.

Thanks,
Richard



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


Re: [Linuxptp-devel] [RFC PATCH v2 9/9] Make allowedLostResponses configurable

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:12PM -0400, Kishen Maloor wrote:
> This change adds 'allowedLostResponses' as a per-port parameter
> with a default value of 3 (per IEEE 802.1AS-2011, clause 11.5.3).
> (Note that this matches the value of the previously #define'd
> ALLOWED_LOST_RESPONSES, so this change does not alter any prevailing
> behavior)

This is not really in scope for the CMDLS feature.

Did you see this recent post?

 08.Nov'23 Chwee-Lin Choon  [Linuxptp-devel] [PATCH 0/2] Enhanced 
Handling of Multiple Pdelay Responses
 08.Nov'23 Chwee-Lin Choon  ├─>[Linuxptp-devel] [PATCH 1/2] Make 
allowedLostResponses configurable
 08.Nov'23 Chwee-Lin Choon  └─>[Linuxptp-devel] [PATCH 2/2] port: Fix 
multiple pdelay response handling

Please review it, as it also implements allowedLostResponses.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 7/9] Implement the COMMON_P2P delay mechanism

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:10PM -0400, Kishen Maloor wrote:
> From: Andrew Zaborowski 
> 
> This change implements the COMMON_P2P DM by issuing a request
> to the CMLDS for CommonMeanLinkDelayInformation upon expiry of
> the delay timer and handles the response to assimilate the
> received meanPathDelay and NRR.

Cleints using COMMON_P2P don't need to do anything in the delay timer.

Just use the latest pushed TLV from the server.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 6/9] Add plumbing for interacting with the CMLDS

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:09PM -0400, Kishen Maloor wrote:
> This change furnishes the plumbing for interacting with CMLDS
> Link Ports (i.e. ports with "run_cmlds=1").
> 
> It adds internal functions for PTP Ports which employ the
> COMMON_P2P delay mechanism to issue requests to a CMLDS Link Port at
> MID_CMLDS_INFO_NP and handle the response.

This is too complicated.

Let's keep it simple.

I'd like to have this:

1. provide the new TLV via the PUSH mechanism.

2. let clients using DM_COMMON_P2P subscribe to the new TLV.

3. let the client update their peer delay values based on an incoming TLV.

Thanks,
Richard



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


Re: [Linuxptp-devel] [RFC PATCH v2 5/9] Add port_cmlds_ignore()

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:08PM -0400, Kishen Maloor wrote:
> port_cmlds_ignore() assesses incoming messages per the following
> policy:
> 
> * All messages that bear the CMLDS sdoid/domainNumber are directed
> to a CMLDS Link Port context and processed by this function. All other
> messages go through the regular flow (i.e. port_ignore() and beyond)
> based on the the ptp4l instance configuration.
> 
> * PDELAY_REQ, PDELAY_RESP, PDELAY_RESP_FOLLOW_UP and management
> messages for MID_CMLDS_INFO_NP are the only expected message types
> at a CMLDS Link Port. All other received messages at a CMLDS Link Port
> (i.e., bearing the CMLDS sdoid/domainNumber) are ignored.

This patch should be dropped as well.

Who cares whether the peer even implements cmlds?

We just want to measure the peer delay once, and share it locally.

Thanks,
Richard




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


Re: [Linuxptp-devel] [RFC PATCH v2 4/9] Update the PdelayReq/Res flows for CMLDS Link Ports

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:07PM -0400, Kishen Maloor wrote:
> For ports that are configured with "run_cmlds=1", i.e. CMLDS Link
> Ports, this change updates port_pdelay_request(), process_pdelay_req() and
> port_peer_delay() to utilize the CMLDS sdoid/domainNumber/portId
> along code paths where necessary. It also ensures that
> neighborRateRatio is calculated on CMLDS Link Ports and is available
> to users of MID_CMLDS_INFO_NP. Further, process_pdelay_request()
> enforces two-step Pdelay when responding as CMLDS.
> These changes are in accordance to the requirements outlined in
> IEEE 1588, clause 16.6.3.
> 
> In addition, CMLDS Link Ports respond with instance-specific peer delay
> messages to PdelayReqs with an sdoid/domainNumber that match their ptp4l
> instance configuration. This aims to address the requirement outlined
> above NOTE 3 in IEEE 802.1AS-2020, clause 11.2.17.1.
> 
> Note that all these changes take effect only in ports with a
> "run_cmlds=1" setting. Default behavior applies otherwise.

This patch can be dropped.

The text of 1588 strongly suggests that the CMLDS service be stand
alone daemon.  However, we can provide the same functionality without
the extra complexity, by simply letting ptp4l serve the measured peer
delay to any local client.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 3/9] Add DM_COMMON_P2P

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:06PM -0400, Kishen Maloor wrote:
> This change adds COMMON_P2P (IEEE 802.1AS-2020, clause 14.8.5) to the
> enumeration of delay mechanisms and incorporates it into existing code
> paths pertaining to DM_P2P to (where appropriate) maintain parity with
> DM_P2P.
> 
> Co-authored-by: Andrew Zaborowski 
> Signed-off-by: Kishen Maloor 
> ---
>  config.c |  1 +
>  dm.h |  3 +++
>  port.c   | 15 +--
>  unicast_client.c | 10 +++---
>  4 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/config.c b/config.c
> index 3e7587ba81ab..0482554feb28 100644
> --- a/config.c
> +++ b/config.c
> @@ -173,6 +173,7 @@ static struct config_enum delay_mech_enu[] = {
>   { "Auto", DM_AUTO },
>   { "E2E",  DM_E2E },
>   { "P2P",  DM_P2P },
> + { "COMMON_P2P", DM_COMMON_P2P },

Preserve alphabetical order please.

>   { "NONE", DM_NO_MECHANISM },
>   { NULL, 0 },
>  };


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


Re: [Linuxptp-devel] [RFC PATCH v2 2/9] Add configuration options for CMLDS

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:05PM -0400, Kishen Maloor wrote:

> 'cmlds_clockIdentity': This global setting assigns a CMLDS
> clockIdentity to be used by a ptp4l instance on a PTP node that exposes
> CMLDS over one or more links.

Don't really need this.  I know it is specified in 1588, but it is
never exposed in any way, and so please omit it.

> 'run_cmlds': This per-port setting (0/1) declares that a port
> will perform the role of a CMLDS Link Port (IEEE 1588, clause 16.6.1)
> and execute CMLDS Pdelay transactions to conduct link
> delay measurements and further convey those measurements to other
> PTP instances on its node via MID_CMLDS_INFO_NP. Said another way,
> this port will expose CMLDS.

This isn't needed.  Just let every every ptp4l instance publish the
TLV for each port not using DM_COMMON_P2P via its UDS port.  This
should be automatic.

> 'cmlds_portNumber': This per-port setting in a PTP instance
> specifies the CMLDS Link Port portNumber.

Again this is useless.  Please drop it.
 
> 'cmlds_uds_address': This per-port setting in ptp4l instances specifies
> the 'uds_address' of a ptp4l instance on the PTP node that exposes the
> CMLDS. A port which employs the COMMON_P2P delay mechanism would
> communicate with the CMLDS over the UDS.

This option is needed.

But you need one more option: the port index of the ptp4l instance
which reports the TLV.  Maybe something like "cmlds_port_index" ?

Thanks,
Richard




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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:04PM -0400, Kishen Maloor wrote:

> @@ -490,6 +491,15 @@ static int mgt_post_recv(struct management_tlv *m, 
> uint16_t data_len,
>   if (data_len != 0)
>   goto bad_length;
>   break;
> + case MID_CMLDS_INFO_NP:
> + if (data_len < sizeof(struct cmlds_info_np))
> + goto bad_length;
> + cmlds = (struct cmlds_info_np *)m->data;
> + net2host64_unaligned(>meanLinkDelay);
> + NTOHL(cmlds->scaledNeighborRateRatio);
> + net2host64_unaligned(>egress_ts);
> + net2host64_unaligned(>rx_ts);
> + break;

Place after MID_POWER_PROFILE_SETTINGS_NP please.

>   }
>   if (extra_len) {
>   if (extra_len % 2)

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:04PM -0400, Kishen Maloor wrote:

> @@ -651,6 +652,18 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
>   fprintf(fp, "LOG_MIN_PDELAY_REQ_INTERVAL "
>   IFMT "logMinPdelayReqInterval %hhd", mtd->val);
>   break;
> + case MID_CMLDS_INFO_NP:
> + cmlds = (struct cmlds_info_np *) mgt->data;
> + fprintf(fp, "CMLDS INFO "
> + IFMT "serviceMeasurementValid %i"
> + IFMT "meanLinkDelay %" PRId64
> + IFMT "scaledNeighborRateRatio %" PRId32
> + IFMT "egress_ts %" PRId64
> + IFMT "rx_ts %" PRId64,
> + cmlds->serviceMeasurementValid, cmlds->meanLinkDelay,
> + cmlds->scaledNeighborRateRatio,
> + cmlds->egress_ts, cmlds->rx_ts);
> + break;

Nit: please place this after MID_POWER_PROFILE_SETTINGS_NP
rather than tacking on the end of the switch/case.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:04PM -0400, Kishen Maloor wrote:

> @@ -473,6 +476,14 @@ struct msg_interface_rate_tlv {
> UInteger16numberOfBitsAfterTimestamp;
>  } PACKED;
>  
> +struct cmlds_info_np {
> + Integer8 serviceMeasurementValid;
> + TimeInterval meanLinkDelay;
> + Integer32scaledNeighborRateRatio;
> + Integer64egress_ts;
> + Integer64rx_ts;
> +} PACKED;

This layout is very poor for packed formats -- think about alignment!

Please order the fields according to size, from largest to smallest.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH v2 1/9] Add new TLV for CommonMeanLinkDelayInformation

2023-11-15 Thread Richard Cochran
On Mon, May 15, 2023 at 06:26:04PM -0400, Kishen Maloor wrote:

> @@ -1129,6 +1130,27 @@ static int port_management_fill_response(struct port 
> *target,
>   memcpy(pwr, >pwr, sizeof(*pwr));
>   datalen = sizeof(*pwr);
>   break;
> + case MID_CMLDS_INFO_NP:
> + cmlds = (struct cmlds_info_np *)tlv->data;
> + /* IEEE1588-2019 16.6.3.2 h) 1) && nrate.ratio_valid because
> +  * we have no extra field to convey that separately.
> +  */
> + cmlds->serviceMeasurementValid =
> + target->peer_portid_valid && !target->pdr_missing &&
> + !target->multiple_pdr_detected &&
> + target->nrate.ratio_valid;
> + cmlds->meanLinkDelay = target->peerMeanPathDelay;
> + cmlds->scaledNeighborRateRatio =
> + (Integer32) (target->nrate.ratio * POW2_41 - POW2_41);

> + /* 16.6.3.2: "Upon receipt of a request for information, the
> +  * Common Mean Link Delay Service may in addition return the
> +  * raw measurement data gathered by the service for use in
> +  * estimating the  and ."
> +  */
> + cmlds->egress_ts = tmv_to_nanoseconds(target->peer_delay_t1);
> + cmlds->rx_ts = tmv_to_nanoseconds(target->peer_delay_t2);

Please drop these two fields.  They don't provide any benefit.  If the
clients don't trust the CMLDS values, then they are free to measure
the p2p delay themselves!

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2 1/2] Some hardware can't properly timestamp packets with the new PTP header version 2.1. This patch introduces a global var ptp_hdr_ver that can be changed externally to

2023-11-10 Thread Richard Cochran
On Fri, Nov 10, 2023 at 02:03:24PM +0100, Maciek Machnikowski wrote:
> Forcing 2.1 also breaks interoperability with some older
> grandmasters which will ignore packets with ptp_minor version set.

Please limit the subject line to one sentence.
Please avoid the phrase, "this patch".

>From linux/Documentation/process/submitting-patches.rst (which everyone should 
>read) ...

Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
to do frotz", as if you are giving orders to the codebase to change
its behaviour.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v2 2/2] Some hardware can't properly timestamp packets with the new PTP header version 2.1. This patch adds legacy_ptp_ver config option that allows advertising of the lega

2023-11-10 Thread Richard Cochran
On Fri, Nov 10, 2023 at 02:03:25PM +0100, Maciek Machnikowski wrote:

> @@ -279,6 +279,7 @@ struct config_item config_tab[] = {
>   PORT_ITEM_INT("interface_rate_tlv", 0, 0, 1),
>   GLOB_ITEM_INT("kernel_leap", 1, 0, 1),
>   GLOB_ITEM_STR("leapfile", NULL),
> + GLOB_ITEM_INT("legacy_ptp_ver", 0, 0, 1),

Please change this to "ptp_minor_version" with an allowed range of 0 to 1.

That way, we will be able to increase the range with each new buggy
version of the PTP standard.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH 0/1] Support for Port level Perforamnce Monitoring Counters

2023-11-10 Thread Richard Cochran
On Fri, Nov 10, 2023 at 07:58:14AM +0100, Luigi 'Comio' Mantellini wrote:

> Using just polling on UDS is a bad idea IMHO because you need to capture at
> the exact same time point all counters of all ports spending a lot of
> effort and cpu.

So make it into a PUSH message.

> It's better to have the gathering
> under the hood and a way to inquiry the system.

No, I disagree.  It should be done externally, because most people
don't want or need this.  These statistics are a waste of time, and I
won't make the program more complex just to support silly stuff.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1] phc_ctl: Implement setting frequency from system time.

2023-11-10 Thread Richard Cochran
On Fri, Nov 10, 2023 at 11:16:38AM +0100, Maciek Machnikowski wrote:

> In my tests it worked fine, but I'd be more than happy to increase it -
> would 5s be sufficient there?

It should be more like 25 seconds, but you may have very loose
requirements.

In any case:

- The interval must be configurable.

- The operation should be its own command.  Don't overload the 'freq' command!

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH 5/5] phc2sys: Stop synchronization when ptp4l stops responding.

2023-11-09 Thread Richard Cochran
On Thu, Oct 26, 2023 at 02:40:11PM +0200, Miroslav Lichvar wrote:

> @@ -942,8 +957,8 @@ static int auto_init_ports(struct domain *domain)
>   }
>  
>   err = pmc_agent_subscribe(domain->agent, 1000,
> -   (60 > domain->phc_interval ?
> -60 : domain->phc_interval) * 3);
> +   (10 > domain->phc_interval ?
> +10 : domain->phc_interval) * 3);

Would it simplify things just to change the 180,60 constants
into 30,10 ?

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH 4/5] phc2sys: Better indicate domain with realtime clock.

2023-11-09 Thread Richard Cochran
On Thu, Oct 26, 2023 at 02:40:10PM +0200, Miroslav Lichvar wrote:

> @@ -1010,7 +1010,7 @@ static int clock_handle_leap(struct domain *domain, 
> struct clock *clock,
>   struct pmc_agent *agent;
>  
>   /* The system clock's domain doesn't have a subscribed agent */
> - agent = domain->agent_subscribed ? domain->agent : 
> domain->src_domain->agent;
> + agent = !domain->has_rt_clock ? domain->agent : 
> domain->src_domain->agent;

Inverted truth!  Why not:

agent = domain->has_rt_clock ? domain->src_domain->agent : 
domain->agent;

Hm?

Thanks,
Richard






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


Re: [Linuxptp-devel] [PATCH] Problem: Under GNSS error condition/fluctuation, ts2phc updating 1sec time into PHC resulting in wrong time.

2023-11-09 Thread Richard Cochran
On Thu, Nov 09, 2023 at 06:07:57PM +, ramesh t via Linuxptp-devel wrote:

> Update Code review request. Can you please provide comments?

You have not identified any problem, and so I cannot comment.

A proper commit message has three elements:

1. context
2. problem
3. solution

That means writing at least three complete, coherent sentences.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] clock: Downgrade log message about failed uds forward.

2023-11-09 Thread Richard Cochran
On Mon, Sep 25, 2023 at 04:38:21PM +0200, Miroslav Lichvar wrote:
> If multiple management clients are used in the network and ptp4l
> responded at least once over UDS, it will try to forward all management
> responses received from network to the last UDS client. ptp4l doesn't
> track the messages and doesn't know if they are responses to the UDS
> client or other clients in the network. If the UDS client is no longer
> running (receiving messages on its address), ptp4l logs "uds port:
> management forward failed" error message. With frequent management
> requests in the network this can lead to flooding of the system log.
> 
> Downgrade the error message to debug to disable it in the default log
> level.
> 
> Signed-off-by: Miroslav Lichvar 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v1] phc_ctl: Implement setting frequency from system time.

2023-11-09 Thread Richard Cochran
On Wed, Sep 13, 2023 at 05:09:04PM +, Maciek Machnikowski wrote:
> Implement auto mode for frequency setting. In this mode the tool
> will measure the frequency difference between PHC and CLOCK_REALTIME
> and apply the correction to the PHC to match the system clock.

...

> + /* Try sysoff first */
> + method = sysoff_probe(fd, N_SAMPLES);
> + if (method >= 0) {
> + if (sysoff_measure(fd, method, N_SAMPLES,
> +_sys_offset,
> +_sys_ts, _delay)) {
> + return -1;
> + }
> +
> + sleep(1);

This measurement interval is WAY too short.  The time stamp error will
spoil the syntonization.
 
> + if (sysoff_measure(fd, method, N_SAMPLES,
> +_sys_offset,
> +_sys_ts, _delay)) {
> + return -1;
> +}
> +
> + sys_diff = t2_sys_ts - t1_sys_ts;
> + clk_diff = t2_sys_offset - t1_sys_offset;
> + ppb += (1e9 - ppb) * ((double)clk_diff / 
> (double)sys_diff);

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH] [pmc] Avoid conflicting port IDs over PMC UDS

2023-11-09 Thread Richard Cochran
On Mon, Sep 11, 2023 at 09:53:54PM +, Keller, Jacob E wrote:
> 
> 
> > -Original Message-
> > From: Eyal Itkin via Linuxptp-devel 
> > Sent: Sunday, September 10, 2023 9:23 AM
> > To: linuxptp-devel@lists.sourceforge.net
> > Subject: [Linuxptp-devel] [PATCH] [pmc] Avoid conflicting port IDs over PMC 
> > UDS
> > 
> > The UDS interface is currently associated with a clock ID of zeros
> > and a 16-bit port number which is the process id. However, the
> > process id on Linux can easily by bigger than 16 bits (supposed
> > to be limited to 22 bits). This means that several linuxptp processes
> > (pmc and phc2sys for instance) can collide and use the same port id.
> > 
> > Hence, use the lower 2 bytes of the process id for the port number,
> > and the top 2 bytes as bytes 7 and 8 of the Clock ID.
> > 
> > Signed-off-by: Eyal Itkin 
> > ---
> 
> Looks like this got sent twice, but it seems reasonable to me.
> 
> Reviewed-by: Jacob Keller 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] BC not responding to each grant request TLV

2023-11-09 Thread Richard Cochran
On Wed, Sep 06, 2023 at 09:15:09AM -0400, Peter Sadrozinski via Linuxptp-devel 
wrote:

> My question: is there any way to configure ptp4l to not concatenate TLVs in
> unicast grant requests?

No.

> The same boundary clock works ok with a
> proprietary ptp stack, which is sending unicast grant requests one message
> type at a time.

We don't add special options for buggy third party crapola.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 1/1] Add the PORTS_STATS_2_NP Management message.

2023-11-09 Thread Richard Cochran
On Wed, Sep 06, 2023 at 09:36:38AM +0200, Luigi Mantellini wrote:
> The PORTS_STATS_2_NP carries all the PORTS_STATS_NP RX/TX counters
> adding room for extra counters (up to 16 counters for RX and TX).
> Not all counters are filled yet.
> 
> The PORTS_STATS_2_NP TLV has the following definition:
> 
> struct port_stats_2_np {
>   struct PortIdentity portIdentity; // As PORT_STATS_NP
>   struct PortStats stats;   // As PORT_STATS_NP
>   struct PortStats extraStats;  // Extra room
> } PACKED;
> 
> The proposed implementation adds the following counters:
> 
> Offset Dir Description
>  0x00  RX  Bad Message
>  0x01  RX  Bad Protocol
>  0x02  RX  Fail on Receive
>  0x03  RX  Missing Timestamp
>  0x04  RX  Announce from Foreign Masters (used by 1588-2019 Annex J)
>  0x05  RX  Announce from current Master
>  0x02  TX  Fail on Transmit
>  0x03  TX  Missing Timestamp

Please don't overload the existing rx/tx message counters in this way.

If you really want to count "Bad Message" etc, please create a new
data structure with fields like "bad_message" etc.

Thanks,
Richard


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


Re: [Linuxptp-devel] [RFC PATCH 0/1] Support for Port level Perforamnce Monitoring Counters

2023-11-09 Thread Richard Cochran
On Fri, Aug 18, 2023 at 02:34:54PM +0200, Luigi Mantellini wrote:
> Dear All,
> 
> Starting from IEEE 1588-2019 Annex J, I'm trying to introduce a Performace
> monitoring Counters.
> 
> The standard asks to keep up 98 records (96 for 15min records and 2 for 24h
> records).
> 
> I tried to follow a more general approach keeping different circular buffer
> for 15min and 24h (and adding also 1h for test purpose).
> 
> The patch need to be split, of course, but it's a starting point to have any
> feedbacks.

My only feedback is:

- the statistics in Annex J are silly, but

- if you really want those, please write a stand alone program that
  gathers the statistics from data input via the UDS interface

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 4/5] phc_ctl: Use pr_notice instead of pr_err for displaying adjusted frequency

2023-11-09 Thread Richard Cochran
On Mon, Sep 25, 2023 at 10:03:12AM -0700, Rahul Rameshbabu via Linuxptp-devel 
wrote:
> Adjusted frequency value displayed by do_freq is not an error, but a
> notication to the user. pr_err should not be used for providing notices
> with information about successful operations.
> 
> Fixes: bdb6a35883b0 ("linuxptp: add phc_ctl program to help debug PHC 
> devices")
> Signed-off-by: Rahul Rameshbabu 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 5/5] phc_ctl: Handle errors returned by various clockadj helpers

2023-11-09 Thread Richard Cochran
On Mon, Sep 25, 2023 at 10:03:13AM -0700, Rahul Rameshbabu via Linuxptp-devel 
wrote:
> Do not print success notices if clockadj operation fails using return
> values provided by the clockadj helpers.
> 
> Signed-off-by: Rahul Rameshbabu 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 3/5] phc_ctl: Add maximum offset capability

2023-11-09 Thread Richard Cochran
On Mon, Sep 25, 2023 at 10:03:11AM -0700, Rahul Rameshbabu via Linuxptp-devel 
wrote:
> Advertise the maximum offset that can be fed to the PHC phase control
> keyword.
> 
> Signed-off-by: Rahul Rameshbabu 

Applied.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 2/5] phc_ctl: Add phase command to support ADJ_OFFSET

2023-11-09 Thread Richard Cochran
On Mon, Sep 25, 2023 at 10:03:10AM -0700, Rahul Rameshbabu via Linuxptp-devel 
wrote:
> Take double precision floating point representation of an offset value in
> seconds. Feed this value to the PHC's phase control keyword.
> 
> Signed-off-by: Rahul Rameshbabu 

Applied, with a trivial fixup.

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH v3 1/5] Rename NSEC2SEC as NSEC_PER_SEC and refactor to util.h

2023-11-09 Thread Richard Cochran
On Mon, Sep 25, 2023 at 10:03:09AM -0700, Rahul Rameshbabu via Linuxptp-devel 
wrote:
> The name NSEC2SEC implies converting nanoseconds to seconds, but the value
> used for the macro converts seconds to nanoseconds. NSEC_PER_SEC is the
> accurate name for this macro. Move macro to common location in util.h.

This patch really has nothing to do with the topic as stated in the
cover letter.  I agree that the existing macro is poorly named, but
the change really needs its own patch series.

If you feel like making the change, then please make a patch series,
starting with adding the new macro, and then converting the modules
one by one to the new macro.  That way a) the review is easier, and
b) reverts are easier in case of regression in one module.

Thanks,
Richard




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


Re: [Linuxptp-devel] [PATCH 00/14] Initial Authentication TLV Support

2023-11-09 Thread Richard Cochran
On Thu, Nov 09, 2023 at 09:44:56AM -0500, Clay Kaiser via Linuxptp-devel wrote:
> The following patch introduces initial support for immediate security 
> processing of
> authentication tlv as defined in IEEE1588-2019 section 16.14.
> 
> Integrity Check Values (aka Message Authentication Codes) are calculated with 
> nettle,
> or gnutls when abstracted mac support is not supported by installed (older) 
> nettle.
> Support is included for SHA256-128, SHA258, AES128, AES256.

Cool.

> I have not seen nor heard of any practical use or application for delayed 
> security
> processing so that is not included. If someone can think of a use, they can 
> surely
> add on.

Yeah, delayed processing is crazy stupid.  After all, it is impossible
to "roll back" synchronization.  The example in the standard has the
disclosed key arriving once every 24 hours.  What the heck were those
guys smoking?

Thanks,
Richard


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


Re: [Linuxptp-devel] [PATCH 2/2] port: Fix multiple pdelay response handling

2023-11-08 Thread Richard Cochran
On Tue, Nov 07, 2023 at 11:07:21PM +, Choong, Chwee Lin wrote:

> Without the proposed fix, the DUT would interpret duplicate
> Pdelay_Resp messages as valid responses, leading to undesired
> behavior, particularly in achieving the "asCapable" state.

Okay, thanks for the clarification.

Richard


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


Re: [Linuxptp-devel] [PATCH 2/2] port: Fix multiple pdelay response handling

2023-11-07 Thread Richard Cochran
On Wed, Nov 08, 2023 at 03:14:06AM +0800, Chwee-Lin Choong wrote:
> The current implementation falls short in detecting duplicate
> pdelay responses, i.e., multiple responses from the same peer.

There can only ever be one peer, and so it is pointless to track the peer.

If more than one peer delay request is detected, then the network is
broken, and there is no corrective action ptp4l can take,

Thanks,
Richard


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


  1   2   3   4   5   6   7   8   9   10   >