From patchwork Wed Apr 5 16:53:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13202266 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 4695EC761AF for ; Wed, 5 Apr 2023 16:54:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA3056B0087; Wed, 5 Apr 2023 12:54:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C2C006B0088; Wed, 5 Apr 2023 12:54:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7BA26B0089; Wed, 5 Apr 2023 12:54:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8C40C6B0087 for ; Wed, 5 Apr 2023 12:54:29 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6C5CF1A0C45 for ; Wed, 5 Apr 2023 16:54:29 +0000 (UTC) X-FDA: 80647935858.30.7BC9EB4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id A520714001B for ; Wed, 5 Apr 2023 16:54:27 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UafgsLpo; spf=pass (imf23.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=1680713667; 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=mV2Euz/SvGe1s9i2UzZ379KdNOAT2pMlJalr2LTSkGw=; b=2bzd6a7rLpD7sQjcYk6JrhTJtLu6F8Ed2wrRhZ8w90mBsuwUpgavIQsx2kwdmpTOh2sOcq fDpet+T5z11GhRIe5DXDtOfXgzuBIH/7OwUCIOiJGCvwjaE8ooFAobntIfmrjRONDZsTBe fdOA7Qqb1GZggkKspnnv0+Z0jxJN448= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UafgsLpo; spf=pass (imf23.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=1680713667; a=rsa-sha256; cv=none; b=i8m0zOIadH7iWv4ICNgyt86GYIBWqRwLOvg73SkGwiYhsYpp0CtiI3vvKTZnzoHYsz7Fuv mdVujRtFUQ6aDAXiasM1jizpfJOvpMmwU9IwvoFaJVl/7EgSGslwfpzJvOcEMAIrtnMGLn hq89bjlAMFT6qB7VMFpeBsj5iXqdwZs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680713667; 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=mV2Euz/SvGe1s9i2UzZ379KdNOAT2pMlJalr2LTSkGw=; b=UafgsLpoIZQgHPXcpukhWnRpXwlJtDYZORT1vWp2sJStu6wxSLJ7IW3IHYWK5LYVaJungx A5ardWqqCmWjuwXSkbmkWBTOsBf8kCufp/Qagi/6baE7dk9Yibn8PBUs9pFT+/uxIaBjzb RzpmZf6z9D44fuSDGnsNvs9mb8nfLKM= 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-191-AWcuO68OMJ-A2c7oOB3JYw-1; Wed, 05 Apr 2023 12:54:24 -0400 X-MC-Unique: AWcuO68OMJ-A2c7oOB3JYw-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 159FC858F09; Wed, 5 Apr 2023 16:54:23 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D2D1C1602A; Wed, 5 Apr 2023 16:54:20 +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 Subject: [PATCH net-next v4 13/20] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Wed, 5 Apr 2023 17:53:32 +0100 Message-Id: <20230405165339.3468808-14-dhowells@redhat.com> In-Reply-To: <20230405165339.3468808-1-dhowells@redhat.com> References: <20230405165339.3468808-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspamd-Queue-Id: A520714001B X-Stat-Signature: d6dwj8sirxkghbwuaadbg85heeqsyjyq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1680713667-755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ovF/KYLzz3bcBoM6hX47q/aZv4Gc0GW6TQtcBBmFRF+tST0cS/kqpPS96k6T50kCfKStJOHt4agnKGeBx8PSQ0swRNJ8bohA6j5JiaLkW2T1EbndPQGSfhpEMfz7/pnkDWeZ9te/YvzpltFbpipvIUkU48jv9vXshiqCFbfKJTEHBCoqc5VmKjBXNEPP/DV2+Kn2O0/+rRwn27TdQhLYt2876fP3bVqmx2RtYx+PUqea4P2rm+4HyoEAYHE0TLedjiYJHjtARHDtEcq3a9eH8iAmVe82lQ3U80Rh7Wzeta+8FDq2A9i4P5w0eCra9FPJLDM/vbvhsgHbE82ET/IFt0KAQQPMBiFEsib9P9UVlCHkW16G/Foo/sCubZYXuPIIethcBesW+MlpUNGL7R5yo70AtCT2vJkjlo6U9BDre4n5fsCrYBkfKLm 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: Fold do_tcp_sendpages() into its last remaining caller, tcp_sendpage_locked(). Signed-off-by: David Howells cc: Eric Dumazet cc: "David S. Miller" cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- include/net/tcp.h | 2 -- net/ipv4/tcp.c | 21 +++++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index a0a91a988272..11c62d37f3d5 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -333,8 +333,6 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, int flags); int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, size_t size, int flags); -ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, - size_t size, int flags); int tcp_send_mss(struct sock *sk, int *size_goal, int flags); void tcp_push(struct sock *sk, int flags, int mss_now, int nonagle, int size_goal); diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a8a4ace8b3da..c7240beedfed 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -972,12 +972,17 @@ static int tcp_wmem_schedule(struct sock *sk, int copy) return min(copy, sk->sk_forward_alloc); } -ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, - size_t size, int flags) +int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, + size_t size, int flags) { struct bio_vec bvec; struct msghdr msg = { .msg_flags = flags | MSG_SPLICE_PAGES, }; + if (!(sk->sk_route_caps & NETIF_F_SG)) + return sock_no_sendpage_locked(sk, page, offset, size, flags); + + tcp_rate_check_app_limited(sk); /* is sending application-limited? */ + bvec_set_page(&bvec, page, size, offset); iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, size); @@ -986,18 +991,6 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, return tcp_sendmsg_locked(sk, &msg, size); } -EXPORT_SYMBOL_GPL(do_tcp_sendpages); - -int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, - size_t size, int flags) -{ - if (!(sk->sk_route_caps & NETIF_F_SG)) - return sock_no_sendpage_locked(sk, page, offset, size, flags); - - tcp_rate_check_app_limited(sk); /* is sending application-limited? */ - - return do_tcp_sendpages(sk, page, offset, size, flags); -} EXPORT_SYMBOL_GPL(tcp_sendpage_locked); int tcp_sendpage(struct sock *sk, struct page *page, int offset,