lkml.org 
[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] [RFC v2] packet: experimental support for 64-bit timestamps
On Tue, Nov 28, 2017 at 3:24 PM, Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
> On Tue, Nov 28, 2017 at 8:14 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> Unfortunately, we're already stuck with SOL_PACKET/PACKET_TIMESTAMP
> accepting SOF_TIMESTAMPING_RAW_HARDWARE.
>
> Perhaps we can define a new PF_PACKET specific enum where the
> equivalent option has the same value, so is backwards compatible:
>
> enum {
> PACKET_TIMESTAMP_ORIG = 0,
> PACKET_TIMESTAMP_ZERO = 1 << 0,
> PACKET_TIMESTAMP_NS64 = 1 << 1,
> PACKET_TIMESTAMP_HW = 1 << 6
> };
>
> and BUILD_BUG_ON(PACKET_TIMESTAMP_RAW != SOF_TIMESTAMPING_RAW_HARDWARE)
> to document the dependency.

Yes, that would be much cleaner, but in order to do this, we have to
be relatively
confident that existing users don't pass any flags other than
SOF_TIMESTAMPING_RAW_HARDWARE. It might be safer to start
at bit 31 for the new flags to minimize that risk:

/*
* we used to pass SOF_TIMESTAMPING_RAW_HARDWARE from user space,
* but really want our own flags here, so define PACKET_TIMESTAMP_HW to the
* existing value and use the high bits for new non-overlapping flags.
*/
enum {
PACKET_TIMESTAMP_ORIG = 0,
PACKET_TIMESTAMP_HW = 1 << 6,
PACKET_TIMESTAMP_ZERO = 1 << 30,
PACKET_TIMESTAMP_NS64 = 1 << 31,
};

> At high level, the code looks great to me, itself.

Thanks,

Arnd

\
 
 \ /
  Last update: 2017-11-28 15:46    [W:1.334 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site