Message ID | 20230331160914.1608208-12-dhowells@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7223C761A6 for <linux-mm@archiver.kernel.org>; Fri, 31 Mar 2023 16:10:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD3C66B0085; Fri, 31 Mar 2023 12:10:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A849D6B0087; Fri, 31 Mar 2023 12:10:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8844B6B0089; Fri, 31 Mar 2023 12:10:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 66B966B0085 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 12:10:03 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1F4C3AC8C6 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:10:03 +0000 (UTC) X-FDA: 80629679886.08.D9D52B3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 53B451C0005 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:10:00 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GxPDgYvP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680279000; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DjALLcCTAkJ9GFGzQm0mxszTSA2UBcCYteYf8nsJBJs=; b=JS8sap7aSPgbWI2GWyGRtKrqIMm+anRmpqdji1TODY4P17WEQykP/ja8qi4Ovyl//491aK BWTsdSKcVucnQNw4NOMSzLTQide/m4UrzaHYuwG2fKduD6xjYxKelXzT13mdpUdsBqHE1z n6DGPcPd6j2ie6KWjfRYMtMnHRDxE6M= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GxPDgYvP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680279000; a=rsa-sha256; cv=none; b=YPW0Tq1hEF/Vhpf8ogE2qVR/W4Q/1QOqgZOkzML8Im83d7o5gk73IrVVuLNfZQCCZZyN2D 9FU37XvyQabXJE4UPhXfeyPAuBdq7YNwjCty8lpc/UtpksOmSIWW56al/laZa/FVHdnD78 rTjzi5hyfqeMWWcFRYjzckoZAVi6kyc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680278999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DjALLcCTAkJ9GFGzQm0mxszTSA2UBcCYteYf8nsJBJs=; b=GxPDgYvPRX/ariiNcKyqM9dHkEBU9W7pRsxWUUYgFgs7xyfIR5LQGps9QuEgLeZLPhPUGm u0cQe8KxCQVWS7a34Hhm2PHvYIUpOrpR932woIqrC+/YbO0e3Ghmg3nZaNXyZdpel3l7Ov UYXQI9amaZo8/Kgyw+Q5XqBlIixa0eE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-mHwARYpIOEOh1orxqULtjA-1; Fri, 31 Mar 2023 12:09:54 -0400 X-MC-Unique: mHwARYpIOEOh1orxqULtjA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C9393823A13; Fri, 31 Mar 2023 16:09:53 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B30A12166B33; Fri, 31 Mar 2023 16:09:50 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Matthew Wilcox <willy@infradead.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: David Howells <dhowells@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org>, Jens Axboe <axboe@kernel.dk>, Jeff Layton <jlayton@kernel.org>, Christian Brauner <brauner@kernel.org>, Chuck Lever III <chuck.lever@oracle.com>, Linus Torvalds <torvalds@linux-foundation.org>, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Steffen Klassert <steffen.klassert@secunet.com>, Herbert Xu <herbert@gondor.apana.org.au> Subject: [PATCH v3 11/55] espintcp: Inline do_tcp_sendpages() Date: Fri, 31 Mar 2023 17:08:30 +0100 Message-Id: <20230331160914.1608208-12-dhowells@redhat.com> In-Reply-To: <20230331160914.1608208-1-dhowells@redhat.com> References: <20230331160914.1608208-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 53B451C0005 X-Stat-Signature: sr66gjiub98awwp1q8hjrto4cqegskwg X-HE-Tag: 1680279000-188830 X-HE-Meta: U2FsdGVkX1/7E8AncBeCdPMG8WCbeXAeLAQWWpeoBT5nLhMnPW1azizfbLAC055AyghL9SZ2D5YoQTbybVCNCzMbZ58Afn57WatH0aI5nCATPFEbFRJbvsLw9dI3cW/g9QvkJgKIljT/bFK0CIbm86srL4Q9i0dDvAq1I8h2PJtwom6U86aHbXqVtws3CBQdw2IN4WbjSJJWQbfd8qgTxX1ro8/P05AZPaWfmUKeVzUlFsTi5L6HQbxppEfc6nHcWvqXgioNG5fQt20yLAjr5BMYj9AOh78/cLreBAYC8qSJc/fyL11LW4vjUN4qREHkIy7Lfci+h3SmvpxVI6s+SZJkNjKQBZSq0WLMtP+VzMBBcSraY5xqJApAxLZKrK0wJb1HlZRsXB1zg3SSC1Zc9BQVS3OlfBxi84Waw2cHuL7kcP+ESoH0eswOtNFEbORq0YlX7xS3CuBDhg19bMQ2/tj6aaeblsFPYthKeJng+6kxCmrZNp1egOP0mQBdQcu7Pc2N2Lpwu6O6rZUu4aIoo9xgFrmN/NjRVc5HHMzvoOAjyoQE4nsdxmiX8OLlQj2NoN6B9mZey1AiVnY/CYnpcwzzAdboNNp9EdPUSYvXcTm5WILOsm1cZQQfHR9gBMxPjWuj+l7bCr98aR+H/AyAX9OhIirYUgWSsur01L98q1dyApKNTqS0y48uhjhlfVoK4vc+3DV/3m8dHlAmg0fZkL8KgJRBo4vTZAyyoiageqOIg9QlsQgsisr2LbrheIdR+MoxNVj59hP6DP5oYE4ngG6C7+ggtjAdsM8ZmtiaZOBkHr5Q0g7f8Knt2DJ6MX4STDyBztPZXkzUviadzelF+39g8Urx/+Nd+K5Mb75uEOnrK2SkGqdDQ4TH7Zn2Z92yEsoTE9stY3oVWI+zugyB+5HRMQlfbmRwbxZh/D1zC+cmVDu+Da3cnuu1JODJec9MX1McPNN33+J32WM24I7 gx0g/zu1 QIbsSrx2Hl7kCiyrgz2XseJ0jUMucqnbnWPL5+VQ8vWTtsnlDkG89r1b5EKjDigQl5eq9W/pvTQMKchEHDr8dd8S8fFUnFhCe1YQmyW+i5l6PdFeT+42WU8IgYMiNWaiJvYJAhzchhpyixsP4yCEZanW/bhI1F5ZO2tX3ExL8OWFJCRGWcdWqUi3TDYZZDsTekSziykHBwxpK33JOW5qGs56QRO5qWbuorIk70X9CEUysA/FfzN5OS2wmd6+i1FzDqBME1Ib17T+UhlqJ/rL8UcTd+Lwv4LYZEhN/k+jZ0C9VVQtdVpYWQ9GKMXoRACNv1Emcx2Cq3F+TIH2tCg8Rajv6x396tSvOYQVmKcEtbvLBcgYntDkwPG7PX0Tj91t1SI6+/bEaUzTPWHAWSHzt0B/3RsJX3c22P76baHGwbJN4OCQ/vyygh4mt2+tcdcWv8Zkb8LVrvN+0dP2Er1tT6bqMV8jaDbgU/gxi6DyfVs5lHS4H9i6iVc49sRkzJuKFLB4CDSs5VpkQR+dwXMMa3uLB7dobhlPMEYSQhqZtbQspCzmXTjvoeBz7tA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
splice, net: Replace sendpage with sendmsg(MSG_SPLICE_PAGES)
|
expand
|
diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c index 872b80188e83..3504925babdb 100644 --- a/net/xfrm/espintcp.c +++ b/net/xfrm/espintcp.c @@ -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;
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: Eric Dumazet <edumazet@google.com> cc: "David S. Miller" <davem@davemloft.net> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> cc: netdev@vger.kernel.org --- net/xfrm/espintcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)