From patchwork Thu Mar 16 15:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13177806 Return-Path: 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 693E4C7618D for ; Thu, 16 Mar 2023 15:26:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 067BD940009; Thu, 16 Mar 2023 11:26:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 01703940007; Thu, 16 Mar 2023 11:26:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD1DF940009; Thu, 16 Mar 2023 11:26:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CDB91940007 for ; Thu, 16 Mar 2023 11:26:46 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AA2121C64A0 for ; Thu, 16 Mar 2023 15:26:46 +0000 (UTC) X-FDA: 80575138812.13.10B717D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id EEE52A001B for ; Thu, 16 Mar 2023 15:26:43 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YibKidY1; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678980404; 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=LcAsV0v3134j5eSAsUO2v1/vZKRQsq2RdqrS8sgJO6jT7uETeS+8zRuGff7QkpzDO3zfIB C8GtBKrDOqF03lZfUJ75uKLbW1s2in973pkpja4KezRlQ1VOlaofxbsoHCB2udIpklVrqR yWsq5iLm8aRDqeVuO4mQlyMoUi/GmGs= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YibKidY1; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678980404; a=rsa-sha256; cv=none; b=HtlBT9roo0uPcB0zlm8NBgP5ImIWX/Ed2qmQ6ugYuTx0r/ex8oxuWEsbkv6uCV2rli8FnH 8VXbGszeHAuo5Hop+VRPLnB4sKkOqN2Jq1IXTAyRr3ZpDjYIKFx6iV4PREikRN1OV/1eQO gHBCeMU4ZT9/OZbMaBl4BDhLUVhMHUQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678980403; 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=YibKidY1Dmv7PHLzBMqh1fCh7tjC8dHSN/r4N98+33o/2stv/b20iVLWpKBCjDF1WgsHVY n2zJ0Z0Q7/p557yb7y5L4872pJh8+XTB5cc7FJl0/8pDIIS5rbOhD/4EFPwIdxewE4UM6O EJ56ufjvGNhoIwcUyilsByyvE91grtU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-403-UpLocroTPSOLnFgApGw-Ag-1; Thu, 16 Mar 2023 11:26:40 -0400 X-MC-Unique: UpLocroTPSOLnFgApGw-Ag-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECF4C858289; Thu, 16 Mar 2023 15:26:38 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7E9940D1C8; Thu, 16 Mar 2023 15:26:36 +0000 (UTC) From: David Howells To: Matthew Wilcox , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: David Howells , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Steffen Klassert , Herbert Xu Subject: [RFC PATCH 06/28] espintcp: Inline do_tcp_sendpages() Date: Thu, 16 Mar 2023 15:25:56 +0000 Message-Id: <20230316152618.711970-7-dhowells@redhat.com> In-Reply-To: <20230316152618.711970-1-dhowells@redhat.com> References: <20230316152618.711970-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: afz54yzbdt6mxbqs4es3y78i3dgaoe8b X-Rspamd-Queue-Id: EEE52A001B X-HE-Tag: 1678980403-479216 X-HE-Meta: U2FsdGVkX1+f5FwjRiRKW+P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ztmyImDpBkXZgVonN2pFkW1ujHfDEOH9Em4y5GHaQPZA/4OKNobsalIx7ZPTD+0iThkqRD5z8Ow5GXRSmjShuCN88SkiWF36VsbVPixmT//+Kgs5gVwDTNzbIuyV86P+fHan92hs7Nz3GqV/2Dd7qfmavBTXLWZlX6WxoFlIEIYlje91RZG7ktcIq6bZ69SBcXmRQXEbgbrziBQDixhpTktIoR1w4iDotUkwzzMkypo3gZUzEYoWZZTu9zFY606vJulB5og/sKRsH+z+Hf6iWPt9dFrskOtfNlczESs/UrHjE/rj0w/TRBrTk3QG9ngf8qtI+bT473DdpClyrulbZj1Hb2fUHeoJEpHndp7aO3aaCWfywTzpKmaTtziq8tWEPJPD1F8RLkofLHDaKhR+9pHUc75xa44/KZoLB0zJRGbgZXd/tBQVV0DDwi+mIJzX8PBGZQ== 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: 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 cc: Steffen Klassert cc: Herbert Xu cc: Eric Dumazet cc: "David S. Miller" cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- net/xfrm/espintcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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;