[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1Mdza7inJT-KqsdW_WxCurkj23-0RMxciVkved+d9HTQ@mail.gmail.com>
Date: Tue, 28 Nov 2017 15:45:28 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Miroslav Lichvar <mlichvar@...hat.com>,
Willem de Bruijn <willemb@...gle.com>,
Björn Töpel <bjorn.topel@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Francis Yan <francisyyan@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Kees Cook <keescook@...omium.org>,
"Rosen, Rami" <rami.rosen@...el.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Mike Maloney <maloney@...gle.com>,
Sowmini Varadhan <sowmini.varadhan@...cle.com>,
LKML <linux-kernel@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH] [RFC v2] packet: experimental support for 64-bit timestamps
On Tue, Nov 28, 2017 at 3:24 PM, Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
> On Tue, Nov 28, 2017 at 8:14 AM, Arnd Bergmann <arnd@...db.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
Powered by blists - more mailing lists