mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
espintcp: Inline do_tcp_sendpages()
do_tcp_sendpages() is now just a small wrapper around tcp_sendmsg_locked(), so inline it, allowing do_tcp_sendpages() to be removed. This is part of replacing ->sendpage() with a call to sendmsg() with MSG_SPLICE_PAGES set. Signed-off-by: David Howells <dhowells@redhat.com> cc: Steffen Klassert <steffen.klassert@secunet.com> cc: Herbert Xu <herbert@gondor.apana.org.au> 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
ebf2e8860e
commit
7f8816ab4b
@ -205,14 +205,16 @@ static int espintcp_sendskb_locked(struct sock *sk, struct espintcp_msg *emsg,
|
||||
static int espintcp_sendskmsg_locked(struct sock *sk,
|
||||
struct espintcp_msg *emsg, int flags)
|
||||
{
|
||||
struct msghdr msghdr = { .msg_flags = flags | MSG_SPLICE_PAGES, };
|
||||
struct sk_msg *skmsg = &emsg->skmsg;
|
||||
struct scatterlist *sg;
|
||||
int done = 0;
|
||||
int ret;
|
||||
|
||||
flags |= MSG_SENDPAGE_NOTLAST;
|
||||
msghdr.msg_flags |= MSG_SENDPAGE_NOTLAST;
|
||||
sg = &skmsg->sg.data[skmsg->sg.start];
|
||||
do {
|
||||
struct bio_vec bvec;
|
||||
size_t size = sg->length - emsg->offset;
|
||||
int offset = sg->offset + emsg->offset;
|
||||
struct page *p;
|
||||
@ -220,11 +222,13 @@ static int espintcp_sendskmsg_locked(struct sock *sk,
|
||||
emsg->offset = 0;
|
||||
|
||||
if (sg_is_last(sg))
|
||||
flags &= ~MSG_SENDPAGE_NOTLAST;
|
||||
msghdr.msg_flags &= ~MSG_SENDPAGE_NOTLAST;
|
||||
|
||||
p = sg_page(sg);
|
||||
retry:
|
||||
ret = do_tcp_sendpages(sk, p, offset, size, flags);
|
||||
bvec_set_page(&bvec, p, size, offset);
|
||||
iov_iter_bvec(&msghdr.msg_iter, ITER_SOURCE, &bvec, 1, size);
|
||||
ret = tcp_sendmsg_locked(sk, &msghdr, size);
|
||||
if (ret < 0) {
|
||||
emsg->offset = offset - sg->offset;
|
||||
skmsg->sg.start += done;
|
||||
|
Loading…
Reference in New Issue
Block a user