lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210701170712.GB24430@hoboy.vegasvil.org>
Date:   Thu, 1 Jul 2021 10:07:12 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Jonathan Lemon <jonathan.lemon@...il.com>
Cc:     netdev@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH] ptp: Add PTP_CLOCK_EXTTSUSR internal ptp_event

On Thu, Jul 01, 2021 at 09:15:55AM -0700, Jonathan Lemon wrote:
> static void enqueue_external_timestamp(struct timestamp_event_queue *queue,
>                                        struct ptp_clock_event *src)
> {
>         struct ptp_extts_event *dst;
>         unsigned long flags;
>         s64 seconds;
>         u32 remainder;
> 
>         seconds = div_u64_rem(src->timestamp, 1000000000, &remainder);
> 
> 
> It seems like there should be a way to use pps_times here instead
> of needing to convert back and forth.

You could re-factor that to have two callers, with the part that
enqueues in a shared helper function.  The only reason the API has a
64 bit word instead of a timespec is that many, but not all drivers
use timecounter_cyc2time() or similar to calculate the time stamp.

But the ptp_clock_event is really meant to be polymorphic, with
pps_times only set for traditional NTP PPS events (activated by the
PTP_ENABLE_PPS ioctl).

 * struct ptp_clock_event - decribes a PTP hardware clock event
 *
 * @type:  One of the ptp_clock_events enumeration values.
 * @index: Identifies the source of the event.
 * @timestamp: When the event occurred (%PTP_CLOCK_EXTTS only).
 * @pps_times: When the event occurred (%PTP_CLOCK_PPSUSR only).

The PTP_CLOCK_EXTTS is different.  It is meant for generic time
stamping of external signals, activated by the PTP_EXTTS_REQUEST
ioctl.

I'm not sure which type is better suited to your HW.

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ