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] [thread-next>] [day] [month] [year] [list]
Message-ID: <7bfe8094-17d7-47d0-bb13-eec0621d813d@gmail.com>
Date: Thu, 12 Jun 2025 15:26:04 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Jens Axboe <axboe@...nel.dk>, io-uring@...r.kernel.org,
 Vadim Fedorenko <vadim.fedorenko@...ux.dev>
Cc: netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
 Kuniyuki Iwashima <kuniyu@...zon.com>, Paolo Abeni <pabeni@...hat.com>,
 Willem de Bruijn <willemb@...gle.com>, "David S . Miller"
 <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
 Richard Cochran <richardcochran@...il.com>,
 Stanislav Fomichev <sdf@...ichev.me>, Jason Xing <kerneljasonxing@...il.com>
Subject: Re: [PATCH v3 5/5] io_uring/netcmd: add tx timestamping cmd support

On 6/12/25 15:12, Jens Axboe wrote:
> On 6/12/25 3:09 AM, Pavel Begunkov wrote:
>> Add a new socket command which returns tx time stamps to the user. It
>> provide an alternative to the existing error queue recvmsg interface.
>> The command works in a polled multishot mode, which means io_uring will
>> poll the socket and keep posting timestamps until the request is
>> cancelled or fails in any other way (e.g. with no space in the CQ). It
>> reuses the net infra and grabs timestamps from the socket's error queue.
>>
>> The command requires IORING_SETUP_CQE32. All non-final CQEs (marked with
>> IORING_CQE_F_MORE) have cqe->res set to the tskey, and the upper 16 bits
>> of cqe->flags keep tstype (i.e. offset by IORING_CQE_BUFFER_SHIFT). The
>> timevalue is store in the upper part of the extended CQE. The final
>> completion won't have IORING_CQR_F_MORE and will have cqe->res storing
>                          ^^^^^^^^^^^^^^^^^
> 
> Pointed this out before, but this typo is still there.

Forgot about that one

> 
>> diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
>> index cfd17e382082..5c89e6f6d624 100644
>> --- a/include/uapi/linux/io_uring.h
>> +++ b/include/uapi/linux/io_uring.h
>> @@ -968,6 +968,15 @@ enum io_uring_socket_op {
>>   	SOCKET_URING_OP_SIOCOUTQ,
>>   	SOCKET_URING_OP_GETSOCKOPT,
>>   	SOCKET_URING_OP_SETSOCKOPT,
>> +	SOCKET_URING_OP_TX_TIMESTAMP,
>> +};
>> +
>> +#define IORING_CQE_F_TIMESTAMP_HW	((__u32)1 << IORING_CQE_BUFFER_SHIFT)
>> +#define IORING_TIMESTAMP_TSTYPE_SHIFT	(IORING_CQE_BUFFER_SHIFT + 1)
> 
> Don't completely follow this, would at the very least need a comment.
> Whether it's a HW or SW timestamp is flagged in the upper 16 bits, just
> like a provided buffer ID. But since we don't use buffer IDs here, then
> it's up for grabs. Do we have other commands that use the upper flags
> space for command private flags?

Probably not, but the place is better than the lower half, which
has common flags like F_MORE, especially since the patch is already
using it to store the type.

> The above makes sense, but then what is IORING_TIMESTAMP_TSTYPE_SHIFT?

It's a shift for where the timestamp type is stored, HW vs SW is
not a timestamp type. I don't get the question.

-- 
Pavel Begunkov


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ