From patchwork Thu May 18 11:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13246568 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 4685EC77B7D for ; Thu, 18 May 2023 11:35:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4A3D280004; Thu, 18 May 2023 07:35:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CFAD3900003; Thu, 18 May 2023 07:35:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE961280004; Thu, 18 May 2023 07:35:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ACC03900003 for ; Thu, 18 May 2023 07:35:41 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1EDBC1A07D1 for ; Thu, 18 May 2023 11:35:41 +0000 (UTC) X-FDA: 80803170882.27.2D786E0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 6266A18000E for ; Thu, 18 May 2023 11:35:39 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IkpdP4dY; spf=pass (imf16.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1684409739; a=rsa-sha256; cv=none; b=h91Qx5/Dpb5yynwdNOQfr6yKFNQQqplnbVVcMLs8Dhjq0zNbEnw4OC5553V0qLVAP7deVJ tJZtannMZbBT1NIZZglqtShx3ImrfROUiXCqy8Z5PoadBjo/OHktkZwmSwS8+LGfaA3rYx NO3kLqnaSmViZx2B9hGPDmCRGqFCoXw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IkpdP4dY; spf=pass (imf16.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1684409739; 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=HD8bmpJwZr1DGRbPQQkCErbdqwXyUpKSYstJlCEaHGQtSg+rWQKmLIF0lwtYSGgwbjAXwc cqnNqref+qB3XuJTE3c0ihqCZ69tho8O2cN5f5oxO4F+awRzxC244MI0WpiApKCltjAwCt 3wxncC8mg3JHYxcjkNl73F972HT/rwQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684409738; 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=IkpdP4dYySEBDFP3NmdBkEPmbop7YFSufs50b6Qepgd+hJPxvCq+tGwbuNQE4iOxh9EVCa bXY1c9ycz85dxWDOBmiM6095FIj+gSbXevzZ0ve70uCFDgO6NRnekG/zDtxwu0FPVEmMkD JLe/EpN4CqtEYN7a8QT9VIE+C0yhU4A= 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-214-HshzOJ6CNxe9-YY1obDoFw-1; Thu, 18 May 2023 07:35:35 -0400 X-MC-Unique: HshzOJ6CNxe9-YY1obDoFw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 724DA1C09512; Thu, 18 May 2023 11:35:34 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id E91B3492B01; Thu, 18 May 2023 11:35:29 +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 v8 07/16] espintcp: Inline do_tcp_sendpages() Date: Thu, 18 May 2023 12:34:44 +0100 Message-Id: <20230518113453.1350757-8-dhowells@redhat.com> In-Reply-To: <20230518113453.1350757-1-dhowells@redhat.com> References: <20230518113453.1350757-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 6266A18000E X-Stat-Signature: 8i4w1hzajjgffbwoa3iq565t4ccwtinh X-HE-Tag: 1684409739-715196 X-HE-Meta: U2FsdGVkX18QXCA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Ql9x0YNsKkHSIpVmXy4Yyx7o3t8SDGm+CCgc+C9+nVg4UNs2OFyjYDkSngl4NeZ2K5DpRsloTHeia32QM5YQvvU1hwo19/+84t4KBqyELySY1xn56h2j3i7sDSrmzOyTuVqxzIGulI9mpkKpnweYuY8KzMZ/Kwn1iNOoWgor7gzP7vuDDYFlvDu71K/8DqiIvUNWcbu5nrjJxi4BPSwmHeOjNSOtXIB65IES+jIYToULw2yX9fiL/rIPVBKB4vY8SWhOSa3eVNBwSf8I/lxksKmafeIeYG8uvlfyG1NU+JHDyWnIf1iOfdTKvRtoNDWrcFZThDkLZV/lFGcXABTZc6JNGwEunCQhJrazT4URdkTkjBnbtloAptqOcfho/nx9AbOxza1o2ZrUAdPYwN3cLE0N6v/6iPwZJPSGLHylvChDma3IELcBNdajKtmX2mKh5RImAYks3jQPQ/buvB9rjtEgYAZ/l+rmfOIbdqcLbEcp3fMdteKxxto5wzr3LQGf7InIxHCgz5q6ye1CgNckIg= 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;