From patchwork Mon May 22 12:11:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13250300 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 F0099C77B73 for ; Mon, 22 May 2023 12:12:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF5E2900002; Mon, 22 May 2023 08:11:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7B86900009; Mon, 22 May 2023 08:11:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA78F900002; Mon, 22 May 2023 08:11:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9E559900009 for ; Mon, 22 May 2023 08:11:59 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6B60A1C6D33 for ; Mon, 22 May 2023 12:11:59 +0000 (UTC) X-FDA: 80817777558.14.EF96A78 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id A2A3F18000E for ; Mon, 22 May 2023 12:11:57 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fMqi8Psc; spf=pass (imf24.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=1684757517; 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=tYeoTX9B8dad49qWPHePVLYzX6oyR1jBlVymL6Q5Zsc=; b=SEoCcRKS0d29iF/Cuci+KAtgwvSPD78m0DLC8QFAkA3Il8bJ9Ql0s9sBmpsxZYV7Ym7UF4 uBcip/yGXlPud/thnkBsKGpN1iD/GoRQaIiI336xLhjy31G1klUin9k+/R88Md/eHzfjKw aWyQiYwkEhsIkhZm5Q7ScgVrJzY9U7k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684757517; a=rsa-sha256; cv=none; b=HICpr38SygISIi5DUtGlP/Z96cM4aaTWx0LU+9eJJJNNr1/BlQmdS0R4L4kcexsQRWax/M IbfTTn620b0KfWVGzQ1T6AUSm/xBCvSVLKKVNE9myRFuvv+MhdTbtgqoB5+Kc0y3UpUquq L4RdtSv2yMp9fIM1uFMG0Ed4IveANms= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fMqi8Psc; spf=pass (imf24.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684757516; 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=tYeoTX9B8dad49qWPHePVLYzX6oyR1jBlVymL6Q5Zsc=; b=fMqi8PscSIe9Sgg1KlqW2tWlB/n3zSZOqpWYU+aRGY94roLVCIFwPxp+MGXQ7JVPDqrwrX kBNJIgSST+EapzYj0iMpBom7pDIf51kZUKGSvaiPKSb0psBcx3/EHWePPme8q68yO5LFfw bIiqRJd7eTjv1e1OWT1ci0u+r+yHKww= 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-329-z_k6b1dFNWyCPfMJlHKjGw-1; Mon, 22 May 2023 08:11:55 -0400 X-MC-Unique: z_k6b1dFNWyCPfMJlHKjGw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 096DF811E8F; Mon, 22 May 2023 12:11:54 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9261C54F80; Mon, 22 May 2023 12:11:50 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Chuck Lever III , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Steffen Klassert , Herbert Xu Subject: [PATCH net-next v10 07/16] espintcp: Inline do_tcp_sendpages() Date: Mon, 22 May 2023 13:11:16 +0100 Message-Id: <20230522121125.2595254-8-dhowells@redhat.com> In-Reply-To: <20230522121125.2595254-1-dhowells@redhat.com> References: <20230522121125.2595254-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Stat-Signature: am9ffdxok3zh8cw7dr4tfeiem6jmcrwx X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A2A3F18000E X-Rspam-User: X-HE-Tag: 1684757517-936317 X-HE-Meta: U2FsdGV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UeGLG3VdakdgxmStsTq7Rx9RNr09iThQFXs9k7xtj6gvVnm5HED2o1JJa28Jwj1xVtU+fbGPspewIOsM9e7jM710KwGL5v3Tiax0Co024sjdR2j3a03ZCA+3pMnCxAia2z9EDIcjsx09baL7O5Xw0naVVkyURuI19XcB3r18FrkROinYsPL3LQByvh0gbPz7wamLQWGmbdYULfvOiPU2pcReGfhWIj3eEjJyAEcIdRwHpNew6vjLEPp2dzJOuQEYMdxabw7W37J8wtTXexQGJr8ttRi51Xrczq4GUDXSjcqSwKif8Gl2TowjCeHEtCw0e/KVGxY3tBM/g70XS2cKh7AnE34qOcQMi3tL49+iQwXQp/poCGCoGaRQEUwv2myxCOHASScX78FysNugdEesvmV+fhpDDlix79TAGJhEwL+A4MH7IbekWptT+J4SoQmi2EUK7CkO5iAX6MlZeBURoel+0dJ9999Vhw1r2Tz8/8VJeMPvtZEfFyE6L4u3FsrwmSOTubawDTI= 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: David Ahern 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;