Linux io-uring development
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: David Wei <dw@davidwei.uk>, io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, lizetao <lizetao1@huawei.com>
Subject: Re: [PATCH v3 1/2] io_uring/zcrx: add a read limit to recvzc requests
Date: Mon, 24 Feb 2025 13:11:05 +0000	[thread overview]
Message-ID: <e8cc3c07-6aa5-4aa0-bd6f-5b054f10287b@gmail.com> (raw)
In-Reply-To: <20250224041319.2389785-2-dw@davidwei.uk>

On 2/24/25 04:13, David Wei wrote:
> Currently multishot recvzc requests have no read limit and will remain
> active so as long as the socket remains open. But, there are sometimes a
> need to do a fixed length read e.g. peeking at some data in the socket.
> 
> Add a length limit to recvzc requests `len`. A value of 0 means no limit
> which is the previous behaviour. A positive value N specifies how many
> bytes to read from the socket.
> 
> Data will still be posted in aux completions, as before. This could be
> split across multiple frags. But the primary recvzc request will now
> complete once N bytes have been read. The completion of the recvzc
> request will have res and cflags both set to 0.

Looks fine, can be improved later.

Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>


> Signed-off-by: David Wei <dw@davidwei.uk>
> ---
>   io_uring/net.c  | 16 +++++++++++++---
>   io_uring/zcrx.c | 13 +++++++++----
>   io_uring/zcrx.h |  2 +-
>   3 files changed, 23 insertions(+), 8 deletions(-)
...
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index f2d326e18e67..9c95b5b6ec4e 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
> @@ -817,6 +817,7 @@ io_zcrx_recv_skb(read_descriptor_t *desc, struct sk_buff *skb,
...
>   static int io_zcrx_tcp_recvmsg(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
>   				struct sock *sk, int flags,
> -				unsigned issue_flags)
> +				unsigned issue_flags, unsigned int *outlen)
>   {
> +	unsigned int len = *outlen;
>   	struct io_zcrx_args args = {
>   		.req = req,
>   		.ifq = ifq,
>   		.sock = sk->sk_socket,
>   	};
>   	read_descriptor_t rd_desc = {
> -		.count = 1,
> +		.count = len ? len : UINT_MAX,

typedef struct {
	...
	size_t count;
} read_descriptor_t;

Should be SIZE_MAX, but it's not worth of respinning.

-- 
Pavel Begunkov


  reply	other threads:[~2025-02-24 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  4:13 [PATCH v3 0/2] io_uring/zcrx: recvzc read limit David Wei
2025-02-24  4:13 ` [PATCH v3 1/2] io_uring/zcrx: add a read limit to recvzc requests David Wei
2025-02-24 13:11   ` Pavel Begunkov [this message]
2025-02-24 15:46     ` David Wei
2025-02-24  4:13 ` [PATCH v3 2/2] io_uring/zcrx: add selftest case for recvzc with read limit David Wei
2025-02-24 14:35 ` [PATCH v3 0/2] io_uring/zcrx: recvzc " Jens Axboe
2025-02-24 19:56   ` Jens Axboe
2025-02-24 20:33     ` David Wei
2025-02-24 22:38       ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8cc3c07-6aa5-4aa0-bd6f-5b054f10287b@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dw@davidwei.uk \
    --cc=io-uring@vger.kernel.org \
    --cc=lizetao1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox