From: David Wei <dw@davidwei.uk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH v4 1/6] io_uring/zcrx: always pass page to io_zcrx_copy_chunk
Date: Wed, 2 Jul 2025 15:32:26 -0700 [thread overview]
Message-ID: <bed9ed3c-b1cc-421f-bf0c-0debf3c89de4@davidwei.uk> (raw)
In-Reply-To: <b8f9f4bac027f5f44a9ccf85350912d1db41ceb8.1751466461.git.asml.silence@gmail.com>
On 2025-07-02 07:29, Pavel Begunkov wrote:
> io_zcrx_copy_chunk() currently takes either a page or virtual address.
> Unify the parameters, make it take pages and resolve the linear part
> into a page the same way general networking code does that.
>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
> io_uring/zcrx.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index 797247a34cb7..99a253c1c6c5 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
> @@ -943,8 +943,8 @@ static struct net_iov *io_zcrx_alloc_fallback(struct io_zcrx_area *area)
> }
>
> static ssize_t io_zcrx_copy_chunk(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
> - void *src_base, struct page *src_page,
> - unsigned int src_offset, size_t len)
> + struct page *src_page, unsigned int src_offset,
> + size_t len)
> {
> struct io_zcrx_area *area = ifq->area;
> size_t copied = 0;
> @@ -958,7 +958,7 @@ static ssize_t io_zcrx_copy_chunk(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
> const int dst_off = 0;
> struct net_iov *niov;
> struct page *dst_page;
> - void *dst_addr;
> + void *dst_addr, *src_addr;
>
> niov = io_zcrx_alloc_fallback(area);
> if (!niov) {
> @@ -968,13 +968,11 @@ static ssize_t io_zcrx_copy_chunk(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
>
> dst_page = io_zcrx_iov_page(niov);
> dst_addr = kmap_local_page(dst_page);
> - if (src_page)
> - src_base = kmap_local_page(src_page);
> + src_addr = kmap_local_page(src_page);
>
> - memcpy(dst_addr, src_base + src_offset, copy_size);
> + memcpy(dst_addr, src_addr + src_offset, copy_size);
>
> - if (src_page)
> - kunmap_local(src_base);
> + kunmap_local(src_addr);
> kunmap_local(dst_addr);
>
> if (!io_zcrx_queue_cqe(req, niov, ifq, dst_off, copy_size)) {
> @@ -1003,7 +1001,7 @@ static int io_zcrx_copy_frag(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
>
> skb_frag_foreach_page(frag, off, len,
> page, p_off, p_len, t) {
> - ret = io_zcrx_copy_chunk(req, ifq, NULL, page, p_off, p_len);
> + ret = io_zcrx_copy_chunk(req, ifq, page, p_off, p_len);
> if (ret < 0)
> return copied ? copied : ret;
> copied += ret;
> @@ -1065,8 +1063,9 @@ io_zcrx_recv_skb(read_descriptor_t *desc, struct sk_buff *skb,
> size_t to_copy;
>
> to_copy = min_t(size_t, skb_headlen(skb) - offset, len);
> - copied = io_zcrx_copy_chunk(req, ifq, skb->data, NULL,
> - offset, to_copy);
> + copied = io_zcrx_copy_chunk(req, ifq, virt_to_page(skb->data),
> + offset_in_page(skb->data) + offset,
> + to_copy);
> if (copied < 0) {
> ret = copied;
> goto out;
Looks fine, mechanical changes.
Reviewed-by: David Wei <dw@davidwei.uk>
next prev parent reply other threads:[~2025-07-02 22:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 14:29 [PATCH v4 0/6] zcrx huge pages support Vol 1 Pavel Begunkov
2025-07-02 14:29 ` [PATCH v4 1/6] io_uring/zcrx: always pass page to io_zcrx_copy_chunk Pavel Begunkov
2025-07-02 22:32 ` David Wei [this message]
2025-07-02 14:29 ` [PATCH v4 2/6] io_uring/zcrx: return error from io_zcrx_map_area_* Pavel Begunkov
2025-07-02 22:27 ` David Wei
2025-07-02 22:50 ` Pavel Begunkov
2025-07-02 23:20 ` David Wei
2025-07-02 14:29 ` [PATCH v4 3/6] io_uring/zcrx: introduce io_populate_area_dma Pavel Begunkov
2025-07-02 23:13 ` David Wei
2025-07-02 14:29 ` [PATCH v4 4/6] io_uring/zcrx: allocate sgtable for umem areas Pavel Begunkov
2025-07-02 23:16 ` David Wei
2025-07-02 14:29 ` [PATCH v4 5/6] io_uring/zcrx: assert area type in io_zcrx_iov_page Pavel Begunkov
2025-07-02 14:29 ` [PATCH v4 6/6] io_uring/zcrx: prepare fallback for larger pages Pavel Begunkov
2025-07-02 23:12 ` [PATCH v4 0/6] zcrx huge pages support Vol 1 David Wei
2025-07-02 23:51 ` Pavel Begunkov
2025-07-08 18:00 ` 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=bed9ed3c-b1cc-421f-bf0c-0debf3c89de4@davidwei.uk \
--to=dw@davidwei.uk \
--cc=asml.silence@gmail.com \
--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