From: Jens Axboe Date: Tue, 23 Apr 2024 01:30:05 +0000 (-0600) Subject: Merge branch 'for-uring-ubufops' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3830fff39941bd41f50d3bb8355883276d7b0771;p=linux.git Merge branch 'for-uring-ubufops' of git://git./linux/kernel/git/kuba/linux into for-6.10/io_uring Merge net changes required for the upcoming send zerocopy improvements. * 'for-uring-ubufops' of git://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux: net: add callback for setting a ubuf_info to skb net: extend ubuf_info callback to ops structure Signed-off-by: Jens Axboe --- 3830fff39941bd41f50d3bb8355883276d7b0771 diff --cc io_uring/notif.c index 3485437b207dd,204f0fc7d9663..53532d78a947d --- a/io_uring/notif.c +++ b/io_uring/notif.c @@@ -35,14 -45,31 +35,18 @@@ static void io_tx_ubuf_complete(struct else if (!success && !nd->zc_copied) WRITE_ONCE(nd->zc_copied, true); } - io_tx_ubuf_complete(skb, uarg, success); + + if (!refcount_dec_and_test(&uarg->refcnt)) + return; + + notif->io_task_work.func = io_notif_tw_complete; + __io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE); } + static const struct ubuf_info_ops io_ubuf_ops = { + .complete = io_tx_ubuf_complete, + }; + -static const struct ubuf_info_ops io_ubuf_ops_ext = { - .complete = io_tx_ubuf_callback_ext, -}; - -void io_notif_set_extended(struct io_kiocb *notif) -{ - struct io_notif_data *nd = io_notif_to_data(notif); - - if (nd->uarg.ops != &io_ubuf_ops_ext) { - nd->account_pages = 0; - nd->zc_report = false; - nd->zc_used = false; - nd->zc_copied = false; - nd->uarg.ops = &io_ubuf_ops_ext; - notif->io_task_work.func = io_notif_complete_tw_ext; - } -} - struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx) __must_hold(&ctx->uring_lock) { @@@ -57,12 -84,11 +61,12 @@@ notif->task = current; io_get_task_refs(1); notif->rsrc_node = NULL; - notif->io_task_work.func = io_req_task_complete; nd = io_notif_to_data(notif); + nd->zc_report = false; + nd->account_pages = 0; nd->uarg.flags = IO_NOTIF_UBUF_FLAGS; - nd->uarg.callback = io_tx_ubuf_callback; + nd->uarg.ops = &io_ubuf_ops; refcount_set(&nd->uarg.refcnt, 1); return notif; }