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>
Subject: Re: [PATCH v2 1/2] io_uring/zcrx: add single shot recvzc
Date: Sat, 22 Feb 2025 00:56:51 +0000	[thread overview]
Message-ID: <92bc1fca-ea5e-42eb-bdb3-c53854193ce7@gmail.com> (raw)
In-Reply-To: <20250221205146.1210952-2-dw@davidwei.uk>

On 2/21/25 20:51, David Wei wrote:
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index f2d326e18e67..74bca4e471bc 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
...
>   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;
> +	bool limit = len != UINT_MAX;
>   	struct io_zcrx_args args = {
>   		.req = req,
>   		.ifq = ifq,
>   		.sock = sk->sk_socket,
>   	};
>   	read_descriptor_t rd_desc = {
> -		.count = 1,
> +		.count = len,
>   		.arg.data = &args,
>   	};
>   	int ret;
>   
>   	lock_sock(sk);
>   	ret = tcp_read_sock(sk, &rd_desc, io_zcrx_recv_skb);
> +	if (limit && ret)
> +		*outlen = len - ret;

ret can be negative, the check will pass and the calculations
will turn it into something weird.

-- 
Pavel Begunkov


  parent reply	other threads:[~2025-02-22  0:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 20:51 [PATCH v2 0/2] io_uring zc rx fixed len recvzc David Wei
2025-02-21 20:51 ` [PATCH v2 1/2] io_uring/zcrx: add single shot recvzc David Wei
2025-02-22  0:08   ` Jens Axboe
2025-02-22  1:01     ` Pavel Begunkov
2025-02-22  1:07       ` Jens Axboe
2025-02-23 22:35         ` David Wei
2025-02-24 12:49           ` Pavel Begunkov
2025-02-23 22:39     ` David Wei
2025-02-22  0:40   ` Pavel Begunkov
2025-02-22  0:52     ` Jens Axboe
2025-02-22  1:06       ` Pavel Begunkov
2025-02-22  1:09         ` Jens Axboe
2025-02-22  1:15           ` Pavel Begunkov
2025-02-22  1:09         ` Pavel Begunkov
2025-02-23 22:43     ` David Wei
2025-02-22  0:56   ` Pavel Begunkov [this message]
2025-02-23 22:44     ` David Wei
2025-02-22  8:54   ` lizetao
2025-02-24  0:17     ` David Wei
2025-02-21 20:51 ` [PATCH v2 2/2] io_uring/zcrx: add selftest case for " David Wei

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=92bc1fca-ea5e-42eb-bdb3-c53854193ce7@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dw@davidwei.uk \
    --cc=io-uring@vger.kernel.org \
    /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