Merge branch 'for-uring-ubufops' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorJens Axboe <axboe@kernel.dk>
Tue, 23 Apr 2024 01:30:05 +0000 (19:30 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 23 Apr 2024 01:30:05 +0000 (19:30 -0600)
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 <axboe@kernel.dk>
1  2 
io_uring/notif.c

index 3485437b207dd8d764dd918c8a066f1cd32f733e,204f0fc7d96634427846477f77593b6784593361..53532d78a947d62cc4c84534fad1ca257db40929
@@@ -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_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;
 -      }
 -}
 -
+ static const struct ubuf_info_ops io_ubuf_ops = {
+       .complete = io_tx_ubuf_complete,
+ };
  struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx)
        __must_hold(&ctx->uring_lock)
  {
        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;
  }