Commit 264ba53f authored by David Howells's avatar David Howells Committed by Jakub Kicinski

kcm: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage

When transmitting data, call down into the transport socket using sendmsg
with MSG_SPLICE_PAGES to indicate that content should be spliced rather
than using sendpage.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Tom Herbert <tom@herbertland.com>
cc: Tom Herbert <tom@quantonium.net>
cc: Jens Axboe <axboe@kernel.dk>
cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent de17c685
......@@ -641,6 +641,10 @@ static int kcm_write_msgs(struct kcm_sock *kcm)
for (fragidx = 0; fragidx < skb_shinfo(skb)->nr_frags;
fragidx++) {
struct bio_vec bvec;
struct msghdr msg = {
.msg_flags = MSG_DONTWAIT | MSG_SPLICE_PAGES,
};
skb_frag_t *frag;
frag_offset = 0;
......@@ -651,11 +655,13 @@ static int kcm_write_msgs(struct kcm_sock *kcm)
goto out;
}
ret = kernel_sendpage(psock->sk->sk_socket,
bvec_set_page(&bvec,
skb_frag_page(frag),
skb_frag_off(frag) + frag_offset,
skb_frag_size(frag) - frag_offset,
MSG_DONTWAIT);
skb_frag_off(frag) + frag_offset);
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1,
bvec.bv_len);
ret = sock_sendmsg(psock->sk->sk_socket, &msg);
if (ret <= 0) {
if (ret == -EAGAIN) {
/* Save state to try again when there's
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment