mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
ip6, udp6: Support MSG_SPLICE_PAGES
Make IP6/UDP6 sendmsg() support MSG_SPLICE_PAGES. This causes pages to be spliced from the source iterator if possible, copying the data if not. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. Signed-off-by: David Howells <dhowells@redhat.com> cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com> cc: David Ahern <dsahern@kernel.org> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
7da0dde684
commit
6d8192bd69
|
|
@ -1589,6 +1589,14 @@ static int __ip6_append_data(struct sock *sk,
|
||||||
skb_zcopy_set(skb, uarg, &extra_uref);
|
skb_zcopy_set(skb, uarg, &extra_uref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if ((flags & MSG_SPLICE_PAGES) && length) {
|
||||||
|
if (inet_sk(sk)->hdrincl)
|
||||||
|
return -EPERM;
|
||||||
|
if (rt->dst.dev->features & NETIF_F_SG)
|
||||||
|
/* We need an empty buffer to attach stuff to */
|
||||||
|
paged = true;
|
||||||
|
else
|
||||||
|
flags &= ~MSG_SPLICE_PAGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1778,6 +1786,15 @@ static int __ip6_append_data(struct sock *sk,
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
} else if (flags & MSG_SPLICE_PAGES) {
|
||||||
|
struct msghdr *msg = from;
|
||||||
|
|
||||||
|
err = skb_splice_from_iter(skb, &msg->msg_iter, copy,
|
||||||
|
sk->sk_allocation);
|
||||||
|
if (err < 0)
|
||||||
|
goto error;
|
||||||
|
copy = err;
|
||||||
|
wmem_alloc_delta += copy;
|
||||||
} else if (!zc) {
|
} else if (!zc) {
|
||||||
int i = skb_shinfo(skb)->nr_frags;
|
int i = skb_shinfo(skb)->nr_frags;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user