From patchwork Thu Apr 6 09:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13203056 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 82F21C76196 for ; Thu, 6 Apr 2023 09:43:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1EABD6B007E; Thu, 6 Apr 2023 05:43:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 199A46B0087; Thu, 6 Apr 2023 05:43:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 017E66B0088; Thu, 6 Apr 2023 05:43:27 -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 EA2836B007E for ; Thu, 6 Apr 2023 05:43:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B31A0AB20E for ; Thu, 6 Apr 2023 09:43:27 +0000 (UTC) X-FDA: 80650478454.14.E24866E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 83BD840013 for ; Thu, 6 Apr 2023 09:43:24 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HLudmGwi; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1680774204; 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=iRwawby9bmMsRKxGUlTfZs6PX+zTT51MpoJby/A5nEg9E8uxRncKjxAO8Eewb30/pQsg2T TGKoKxJf/TfD7aADlNiXKPTdr52ASKCKTAOfsd/YgQG8FGd4qIxj6G6H9I4EwC/t+bbiL0 mJnXnfxhwlz8EKOHaPYYjtDxjFAPH2c= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HLudmGwi; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680774204; a=rsa-sha256; cv=none; b=Ce+cN58JcSZee5VzDa1x+AHs249EX0Tmayq4J3FImT31b6N4Ctt3U6OM0aR2YjyHGskxaD y9tmiv804SLU5jqvELC5ZEjE/zyvzw+FtbUQb7797pu7JDydoOMklEs3Z979Ik1GYV6p5Y H7kzzP9HZJlPEYLl7yQOIGexeWx7TvA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680774203; 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=HLudmGwizP9wTKVQyySHfQDH0UjwNOttKjHzOkaqqvJbDFCxXGmSpESKW8iR77ZzpVHeqe Je8vA03DwFaH4s4M8WvJt1TzxiqNP9LCowo1qkHCglTqgQHDnsNcNezlSsEqB3GSruPOsZ 8TaUy1ACRiJKyTYlRdAL9nfJdH+zCBs= 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-119-jk5GdTXgMCaItZ0dnoKllg-1; Thu, 06 Apr 2023 05:43:20 -0400 X-MC-Unique: jk5GdTXgMCaItZ0dnoKllg-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 884003C0ED6C; Thu, 6 Apr 2023 09:43:19 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FFAD2166B26; Thu, 6 Apr 2023 09:43:17 +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 , 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 , David Ahern Subject: [PATCH net-next v5 09/19] espintcp: Inline do_tcp_sendpages() Date: Thu, 6 Apr 2023 10:42:35 +0100 Message-Id: <20230406094245.3633290-10-dhowells@redhat.com> In-Reply-To: <20230406094245.3633290-1-dhowells@redhat.com> References: <20230406094245.3633290-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 83BD840013 X-Stat-Signature: hqzbuwtbhmmogwgcbp8qcrd9z5xt7yp1 X-HE-Tag: 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1M6taPH5WjRA2Q1k49XMr870syWlwgln5wJYhf3jzBUIYNIZQdnOQuhWQ04L9OJIcuorNfev+kpQQFQJja4BMgrp17FnyoKAV0O99vk1BSmogqcsGIlPbwIWaWHLJ8vUn6KCUcbpT8HSw6odexHL4tZOxU8PR5t2fHQrnS4p5iwStPcWLO5kw/zAH0gzfS8qEMlAFFXFhOa1L1AHUU9ZPPKz3J1I3pqtMVzd1f0tPwGyd5ybn0BEidw/j3ELjhq+hTQ2X3zSjsbZvJAAcGYK7SrNWEvJwRImjYC40fCAv5I5jMoPx/vvRNDrQKYKI/6C6rX0v9yO7FLjGDBLIhXlTkpJgCbMy9zCGXXvR0pDGSbKpfGanrgAYz3msLxftoVLKB6thZuMVRdJsDwGb2NHIesL1A40+8jd6t9l1gYl2Yq2Up4yRdP05N6sC4vkDNR7ZHSyX3vHK1hIRd2dg3HcnGVW7TiD5G4QqVsz9k3VCXIdHI6nm7xoqlywnCsZMIdawetOOnFjv4e15z2OrgjQAN9jSHmz8ODz/PTBqhsEVFPzbYGIQ== 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;