lkml.org 
[lkml]   [2021]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 7/7] net: dsa: b53: Expose PTP timestamping ioctls to userspace
    On Fri, 5 Nov 2021 16:28:33 +0200 Vladimir Oltean wrote:
    > On Fri, Nov 05, 2021 at 07:13:19AM -0700, Richard Cochran wrote:
    > > On Fri, Nov 05, 2021 at 02:38:01PM +0100, Martin Kaistra wrote:
    > > > Ok, then I will remove HWTSTAMP_FILTER_PTP_V2_(EVENT|SYNC|DELAY_REQ) from
    > > > this list, what about HWTSTAMP_FILTER_ALL?
    > >
    > > AKK means time stamp every received frame, so your driver should
    > > return an error in this case as well.
    >
    > What is the expected convention exactly? There are other drivers that
    > downgrade the user application's request to what they support, and at
    > least ptp4l does not error out, it just prints a warning.

    Which is sad because that's one of the best documented parts of our API:

    Desired behavior is passed into the kernel and to a specific device by
    calling ioctl(SIOCSHWTSTAMP) with a pointer to a struct ifreq whose
    ifr_data points to a struct hwtstamp_config. The tx_type and
    rx_filter are hints to the driver what it is expected to do. If
    the requested fine-grained filtering for incoming packets is not
    supported, the driver may time stamp more than just the requested types
    of packets.

    Drivers are free to use a more permissive configuration than the requested
    configuration. It is expected that drivers should only implement directly the
    most generic mode that can be supported. For example if the hardware can
    support HWTSTAMP_FILTER_V2_EVENT, then it should generally always upscale
    HWTSTAMP_FILTER_V2_L2_SYNC_MESSAGE, and so forth, as HWTSTAMP_FILTER_V2_EVENT
    is more generic (and more useful to applications).

    A driver which supports hardware time stamping shall update the struct
    with the actual, possibly more permissive configuration. If the
    requested packets cannot be time stamped, then nothing should be
    changed and ERANGE shall be returned (in contrast to EINVAL, which
    indicates that SIOCSHWTSTAMP is not supported at all).

    https://www.kernel.org/doc/html/latest/networking/timestamping.html#hardware-timestamping-configuration-siocshwtstamp-and-siocghwtstamp

    \
     
     \ /
      Last update: 2021-11-05 16:09    [W:2.662 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site