On 11/10/2023 5:43 PM, Erez wrote:
> 
> 
> On Fri, 10 Nov 2023 at 14:05, Maciek Machnikowski
> <mac...@machnikowski.net <mailto:mac...@machnikowski.net>> wrote:
> 
>     Additionally, forcing PTP minor version to be nonzero causes
>     interoperability issues with some legacy grandmasters.
> 
>     Signed-off-by: Maciek Machnikowski <mac...@machnikowski.net
>     <mailto:mac...@machnikowski.net>>
>     ---
>      config.c            | 1 +
>      configs/default.cfg | 1 +
>      ptp4l.8             | 5 +++++
>      ptp4l.c             | 4 ++++
>      4 files changed, 11 insertions(+)
> 
>     diff --git a/config.c b/config.c
>     index b104f1b..f03a9d2 100644
>     --- a/config.c
>     +++ b/config.c
>     @@ -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),
>             PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
>             PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX),
>             PORT_ITEM_INT("logMinPdelayReqInterval", 0, INT8_MIN, INT8_MAX),
>     diff --git a/configs/default.cfg b/configs/default.cfg
>     index 00429b9..f0cc2c2 100644
>     --- a/configs/default.cfg
>     +++ b/configs/default.cfg
>     @@ -46,6 +46,7 @@ power_profile.2011.networkTimeInaccuracy      -1
>      power_profile.2017.totalTimeInaccuracy         -1
>      power_profile.grandmasterID                    0
>      power_profile.version                          none
>     +legacy_ptp_ver          0
> 
> 
> Perhaps legacy_ptp2_min_ver ?
I'll change it to force_compatible_ptp_version

> 
> 
>  
> 
>      #
>      # Run time options
>      #
>     diff --git a/ptp4l.8 b/ptp4l.8
>     index 40c66c2..43dbd5e 100644
>     --- a/ptp4l.8
>     +++ b/ptp4l.8
>     @@ -676,6 +676,11 @@ one-second offset slowly by changing the clock
>     frequency (unless the
>      option is set to correct such offset by stepping).
>      Relevant only with software time stamping. The default is 1 (enabled).
> 
>     +.TP
>     +.B legacy_ptp_ver
>     +This option forces legacy PTP header version 2.0. May be required
>     on some
>     +legacy hardware that expects exact match on PTP header version.
> 
> 
> The default is 1 for 2.1.
> You should be explicit.
No - it's works as described - if this option is enabled - the version
will fallback to the compatible 2.0

>  
> 
>     +
>      .TP
>      .B logging_level
>      The maximum logging level of messages which should be printed.
>     diff --git a/ptp4l.c b/ptp4l.c
>     index c61175b..8eaeaf3 100644
>     --- a/ptp4l.c
>     +++ b/ptp4l.c
>     @@ -192,6 +192,10 @@ int main(int argc, char *argv[])
>             sk_tx_timeout = config_get_int(cfg, NULL,
>     "tx_timestamp_timeout");
>             sk_hwts_filter_mode = config_get_int(cfg, NULL, "hwts_filter");
> 
>     +       if(config_get_int(cfg, NULL, "legacy_ptp_ver")) {
>     +               ptp_hdr_ver = PTP_MAJOR_VERSION;
> 
> 
> This looks bad,
> It should be:
> 
> legacy_ptp2_min_ver = config_get_int(cfg, NULL, ...
> ptp_hdr_ver = (legacy_ptp2_min_ver << 4 | PTP_MAJOR_VERSION);
> The default should be 1.
> config_get_int() return the configured value or the default value.
I don't like using a user input to form anything that's sent over the
wire - I don't see the value in it.

Regards
Maciek
>  
> 
>     +       }
>     +
>             if (config_get_int(cfg, NULL, "clock_servo") ==
>     CLOCK_SERVO_NTPSHM) {
>                     config_set_int(cfg, "kernel_leap", 0);
>                     config_set_int(cfg, "sanity_freq_limit", 0);
>     -- 
>     2.30.2
> 
> 
> 
>     _______________________________________________
>     Linuxptp-devel mailing list
>     Linuxptp-devel@lists.sourceforge.net
>     <mailto:Linuxptp-devel@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
>     <https://lists.sourceforge.net/lists/listinfo/linuxptp-devel>
> 


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

Reply via email to