net: add callback for setting a ubuf_info to skb
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 19 Apr 2024 11:08:40 +0000 (12:08 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 22 Apr 2024 23:21:59 +0000 (16:21 -0700)
commit65bada80dec1f2108a751644773b2120bd789934
tree20ad5053474b841f7c71d74f627c41d1bbd1a27f
parent7ab4f16f9e2440e797eae88812f800458e5879d2
net: add callback for setting a ubuf_info to skb

At the moment an skb can only have one ubuf_info associated with it,
which might be a performance problem for zerocopy sends in cases like
TCP via io_uring. Add a callback for assigning ubuf_info to skb, this
way we will implement smarter assignment later like linking ubuf_info
together.

Note, it's an optional callback, which should be compatible with
skb_zcopy_set(), that's because the net stack might potentially decide
to clone an skb and take another reference to ubuf_info whenever it
wishes. Also, a correct implementation should always be able to bind to
an skb without prior ubuf_info, otherwise we could end up in a situation
when the send would not be able to progress.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/all/b7918aadffeb787c84c9e72e34c729dc04f3a45d.1713369317.git.asml.silence@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/skbuff.h
net/core/skbuff.c