diff options
author | Pavel Begunkov <[email protected]> | 2024-06-27 13:59:42 +0100 |
---|---|---|
committer | Paolo Abeni <[email protected]> | 2024-07-02 12:06:50 +0200 |
commit | 7fb05423fed41686ccc1a76c20d486728f62023f (patch) | |
tree | 9c3cc2a6ae77be07d23a9aadff13e0380afe8883 | |
parent | 9e2db9d3993e270b24fbc4ce1ca7e09756e8df25 (diff) |
net: split __zerocopy_sg_from_iter()
Split a function out of __zerocopy_sg_from_iter() that only cares about
the traditional path with refcounted pages and doesn't need to know
about ->sg_from_iter. A preparation patch, we'll improve on the function
later.
Signed-off-by: Pavel Begunkov <[email protected]>
Reviewed-by: Willem de Bruijn <[email protected]>
Reviewed-by: Jens Axboe <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
-rw-r--r-- | net/core/datagram.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index e614cfd8e14a..ef81d6ecbe1e 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -610,16 +610,10 @@ fault: } EXPORT_SYMBOL(skb_copy_datagram_from_iter); -int __zerocopy_sg_from_iter(struct msghdr *msg, struct sock *sk, - struct sk_buff *skb, struct iov_iter *from, - size_t length) +static int zerocopy_fill_skb_from_iter(struct sock *sk, struct sk_buff *skb, + struct iov_iter *from, size_t length) { - int frag; - - if (msg && msg->msg_ubuf && msg->sg_from_iter) - return msg->sg_from_iter(sk, skb, from, length); - - frag = skb_shinfo(skb)->nr_frags; + int frag = skb_shinfo(skb)->nr_frags; while (length && iov_iter_count(from)) { struct page *head, *last_head = NULL; @@ -692,6 +686,16 @@ int __zerocopy_sg_from_iter(struct msghdr *msg, struct sock *sk, } return 0; } + +int __zerocopy_sg_from_iter(struct msghdr *msg, struct sock *sk, + struct sk_buff *skb, struct iov_iter *from, + size_t length) +{ + if (msg && msg->msg_ubuf && msg->sg_from_iter) + return msg->sg_from_iter(sk, skb, from, length); + else + return zerocopy_fill_skb_from_iter(sk, skb, from, length); +} EXPORT_SYMBOL(__zerocopy_sg_from_iter); /** |