From patchwork Thu May 18 13:07:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13246755 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 91809C77B7A for ; Thu, 18 May 2023 13:08:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 195DA900009; Thu, 18 May 2023 09:08:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 11C73900003; Thu, 18 May 2023 09:08:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6444900009; Thu, 18 May 2023 09:08:27 -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 CFCE9900003 for ; Thu, 18 May 2023 09:08:27 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9C18B80817 for ; Thu, 18 May 2023 13:08:27 +0000 (UTC) X-FDA: 80803404654.30.10D0E3C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 9A0CC20009 for ; Thu, 18 May 2023 13:07:57 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G92AMwAH; spf=pass (imf13.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=1684415277; 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=lTEtgdAROHn4rvhZdhpteFFT1CXmDlaUtHzS5AvQDR2/qYADS6TtkXHQpk1o8HEV32uzhs k0jEWyplDtMrWdD1RItrLo5l0ZL8UdocAh/dVrjQVvwG6p/2OK23114+5LAa09+k1dGdVd 068ElnhSWZ2wvXfw+3wNQybXHOhRu0s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684415277; a=rsa-sha256; cv=none; b=k5cUGETSo3132eZwobbJnvVvGHussUrV3n3aMxiXzgplkjBN5PjhoD3eL7tjpkcX5yyFLx Godr8zHGDH4QxjAwFKs+/bCu4k1Dx4dC12gRJwHTP2STNySbBX+F9As7NHK0TVJU2N9I6Q 8NwbTXTGjuCDFbAXQcQ4BSUshCWeb7Y= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G92AMwAH; spf=pass (imf13.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=1684415276; 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=G92AMwAH/wuYua3fMjsrEKSHeal6tIWIy8oTDPYVMKBzPHA+GcDJJgZTDFsf2O6L9fTTNF EbF8gukG4kpQsZUxz2VA7brFGMDJXHYNACeKnNsB8BrcgClCxQUIWfJ5QF1uO+9QcLP6t8 F76ik4OuOzaIeX6WBtMRTiSDCz9RLaA= 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-539-6BlD0X51NFmY4rfARQLhyQ-1; Thu, 18 May 2023 09:07:53 -0400 X-MC-Unique: 6BlD0X51NFmY4rfARQLhyQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BC7328237C1; Thu, 18 May 2023 13:07:52 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14D062026D16; Thu, 18 May 2023 13:07:48 +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 v9 07/16] espintcp: Inline do_tcp_sendpages() Date: Thu, 18 May 2023 14:07:04 +0100 Message-Id: <20230518130713.1515729-8-dhowells@redhat.com> In-Reply-To: <20230518130713.1515729-1-dhowells@redhat.com> References: <20230518130713.1515729-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 9A0CC20009 X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: izesg9dhthfdq69kwepjmh4oq6w41ruj X-HE-Tag: 1684415277-219745 X-HE-Meta: U2FsdGVkX19wE+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WYntBOOCPsKUCi8oQBNZ5ZabNEGtC3PhCxrlEnK2ZHYjjsT1ToBEN/zKnaSVgYnG2pNMQpcyp8jicmI13Sc4YCxlRiIOt+XvDCigJJ8bEkrIZsCS71TLwZgBhJCTGSmlm1pGVy5+NSB1Phpk4UW7o52h2pkpM9PLEIV3ruIjXIe6dCQvBQWqbp7aqJqIzqbzwSbwVAriPKRVM5wJ6hmFjXRHiauLOGQdl6eB1LazopFWymfLiJz1D+F/OE7Q5aTTZjuuL//EemJ8mPk85kD4P52/pZeuNaAsVF+p9q3qTsjIJE2dTg0f6pxpZziJLpG8Sc2IsTv9V0etyNziIcfBjKsNWKaYAxYwqWOmbc5jlSkeq3+2jeeX59bTvqgWQTRLAbTYPz9wsgZkWgAV9CKKiSJpbQCHUuftrZ2G7o89k8nSKLYJsaQ6RvaUMPabcYjAqSoe3pVGW0IBunaSF4oMhQP+BCw2nIkyYpwVs5hO3ikJhOWIfckuFAJoWjuHK9kTz40R9oA= 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;