Re: [PATCH] [RFC v2] packet: experimental support for 64-bit timestamps

From: Willem de Bruijn
Date: Tue Nov 28 2017 - 09:25:20 EST


On Tue, Nov 28, 2017 at 8:14 AM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> This is a second attempt to allow 64-bit timestamps in packet sockets,

Thanks for coding up this variant.

> The implementation is fairly straightforward, but I'm less sure about the
> interface. Using SOF_TIMESTAMPING_* flags in PACKET_TIMESTAMP is a bit
> odd already since most of the other flags make no sense here. Adding two
> more flags that only make sense for packet sockets but not the normal
> SO_TIMESTAMPING option on other sockets makes this even more confusing.

Agreed.

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.

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