Skip to content

Commit 9986329

Browse files
isilenceaxboe
authored andcommitted
io_uring/net: merge ubuf sendzc callbacks
Splitting io_tx_ubuf_callback_ext from io_tx_ubuf_callback is a pre mature optimisation that doesn't give us much. Merge the functions into one and reclaim some simplicity back. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/d44d68f6f7add33a0dcf0b7fd7b73c2dc543604f.1712534031.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent bbbef3e commit 9986329

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

io_uring/notif.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,24 @@ static void io_tx_ubuf_callback(struct sk_buff *skb, struct ubuf_info *uarg,
3030
struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg);
3131
struct io_kiocb *notif = cmd_to_io_kiocb(nd);
3232

33-
if (refcount_dec_and_test(&uarg->refcnt))
34-
__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
35-
}
36-
37-
static void io_tx_ubuf_callback_ext(struct sk_buff *skb, struct ubuf_info *uarg,
38-
bool success)
39-
{
40-
struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg);
41-
4233
if (nd->zc_report) {
4334
if (success && !nd->zc_used && skb)
4435
WRITE_ONCE(nd->zc_used, true);
4536
else if (!success && !nd->zc_copied)
4637
WRITE_ONCE(nd->zc_copied, true);
4738
}
48-
io_tx_ubuf_callback(skb, uarg, success);
39+
40+
if (refcount_dec_and_test(&uarg->refcnt))
41+
__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
4942
}
5043

5144
void io_notif_set_extended(struct io_kiocb *notif)
5245
{
5346
struct io_notif_data *nd = io_notif_to_data(notif);
5447

55-
if (nd->uarg.callback != io_tx_ubuf_callback_ext) {
56-
nd->account_pages = 0;
57-
nd->zc_report = false;
58-
nd->zc_used = false;
59-
nd->zc_copied = false;
60-
nd->uarg.callback = io_tx_ubuf_callback_ext;
61-
notif->io_task_work.func = io_notif_complete_tw_ext;
62-
}
48+
nd->zc_used = false;
49+
nd->zc_copied = false;
50+
notif->io_task_work.func = io_notif_complete_tw_ext;
6351
}
6452

6553
struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx)
@@ -79,6 +67,8 @@ struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx)
7967
notif->io_task_work.func = io_req_task_complete;
8068

8169
nd = io_notif_to_data(notif);
70+
nd->zc_report = false;
71+
nd->account_pages = 0;
8272
nd->uarg.flags = IO_NOTIF_UBUF_FLAGS;
8373
nd->uarg.callback = io_tx_ubuf_callback;
8474
refcount_set(&nd->uarg.refcnt, 1);

0 commit comments

Comments
 (0)