On Tue, 5 Sept 2023 at 21:56, Rahul Rameshbabu via Linuxptp-devel <
linuxptp-devel@lists.sourceforge.net> wrote:

> Advertise the maximum offset that can be fed to the PHC phase control
> keyword.
>

Someone already sent this patch, a few months ago.
But now we can find it in the official kernel. :-)
https://elixir.bootlin.com/linux/v6.5/source/include/uapi/linux/ptp_clock.h#L204

Erez



>
> Signed-off-by: Rahul Rameshbabu <rrameshb...@nvidia.com>
> ---
>  missing.h | 9 +++++----
>  phc_ctl.c | 4 ++++
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/missing.h b/missing.h
> index 79a87d4..165a297 100644
> --- a/missing.h
> +++ b/missing.h
> @@ -98,9 +98,9 @@ enum {
>  #define PTP_PEROUT_REQUEST2 PTP_PEROUT_REQUEST
>  #endif
>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0)
>
> -/* from upcoming Linux kernel version 5.8 */
> +/* from upcoming Linux kernel version 6.5 */
>  struct compat_ptp_clock_caps {
>         int max_adj;   /* Maximum frequency adjustment in parts per
> billon. */
>         int n_alarm;   /* Number of programmable alarms. */
> @@ -112,12 +112,13 @@ struct compat_ptp_clock_caps {
>         int cross_timestamping;
>         /* Whether the clock supports adjust phase */
>         int adjust_phase;
> -       int rsv[12];   /* Reserved for future use. */
> +       int max_phase_adj;
> +       int rsv[11];   /* Reserved for future use. */
>  };
>
>  #define ptp_clock_caps compat_ptp_clock_caps
>
> -#endif /*LINUX_VERSION_CODE < 5.8*/
> +#endif /*LINUX_VERSION_CODE < 6.5*/
>
>  /*
>   * Bits of the ptp_perout_request.flags field:
> diff --git a/phc_ctl.c b/phc_ctl.c
> index c5430d8..a814648 100644
> --- a/phc_ctl.c
> +++ b/phc_ctl.c
> @@ -355,6 +355,10 @@ static int do_caps(clockid_t clkid, int cmdc, char
> *cmdv[])
>                 "no information regarding"
>                 #endif
>                 );
> +
> +       if (caps.max_phase_adj)
> +               pr_notice("  %d maximum offset adjustment (ns)\n",
> caps.max_phase_adj);
> +
>         return 0;
>  }
>
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
>
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to