From patchwork Thu May 18 11:34:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13246572 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 29F1BC7EE24 for ; Thu, 18 May 2023 11:35:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11659280008; Thu, 18 May 2023 07:35:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00266900003; Thu, 18 May 2023 07:35:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBD2490000D; Thu, 18 May 2023 07:35:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CD238900003 for ; Thu, 18 May 2023 07:35:57 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 805A51607E8 for ; Thu, 18 May 2023 11:35:57 +0000 (UTC) X-FDA: 80803171554.14.8643709 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id BB8F4100011 for ; Thu, 18 May 2023 11:35:55 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=C+fVtVmO; spf=pass (imf14.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=1684409755; 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=enBN5jT1muKlfAJKNsWEtZoec3VPKG1S27Z+IZtkOMs=; b=o6tGiY32LxfIADFAhBXF+BtitrpV6kaKItFlIvhWZ94ONy6kXVNokUnpm+sZNJH8ZpSfos ZGXEYo+HcoxMjvUqQef0D/oB8AlhxwR+jF+yCr2d+63eZhwikW5xERl6oKTvTGxLpi73WO RIQPF6Ur9wQxpzK4N17Op3gRd3nNQGc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684409755; a=rsa-sha256; cv=none; b=p3Z+pq4YtZ8bdCDUSsS5OB1KZ+1v+9fCmFIsir/uRGkanFCdnI8T3K+nyb/6mAPUWNsHGf EZ4wJRa3OrI1ohHSMp/C0jhW3rlXihbJ8wcITZMRreKa3iySc2n9ifb3h/tR3ph1zY7hLT owFWvqNUZA3IBpso35AXRr+n41YhGU8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=C+fVtVmO; spf=pass (imf14.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=1684409755; 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=enBN5jT1muKlfAJKNsWEtZoec3VPKG1S27Z+IZtkOMs=; b=C+fVtVmOFxo1nHGvgoXlMjwJvKN9Lyb8vDqBijHVjGjGMCdyC6pdG4AjW3hoy0hj0Twayn ySk9De/CjxZEPhZ1wC2xTCBYC1q2DOoPxlt6Y8RHpI4Qw9BeBTwlQOUMa2MCOhOyDeJdOD /8enmPdUjgFMxuzm4t48fzRp+cB5N3I= 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-669-zHr-wG-8MFKIw9HgrsEr2A-1; Thu, 18 May 2023 07:35:47 -0400 X-MC-Unique: zHr-wG-8MFKIw9HgrsEr2A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EAFF61014702; Thu, 18 May 2023 11:35:46 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id DADA640C2063; Thu, 18 May 2023 11:35:43 +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 Subject: [PATCH net-next v8 10/16] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Thu, 18 May 2023 12:34:47 +0100 Message-Id: <20230518113453.1350757-11-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.1 X-Stat-Signature: wwe93ab6tn6x5toaa7rzi3ptgtz3juz8 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BB8F4100011 X-Rspam-User: X-HE-Tag: 1684409755-579084 X-HE-Meta: U2FsdGVk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NFRmE7p+B78fWgx/Omy3sULQLfN80yspDvecYLq06Z4cHC38eX51IoGzxnF+AF/4SwP4oAY0+MYR1X/+abYLa2ad3ybdseaz63w4HRmYjJw5QG8EGwCziT5a9DmvIbueiXJq1cNFZq7lHX0k7lAl+QXdBKwlMBGYKZRrlTYqBNd/7uml4DYJpCa3/cF1uTAJ4fKjvNZ/QEC+mWxJK0hpAK/AE8Cbh8D9TyREcJLVDfw+kVE5VMOXBvz6sa3ZCBKMeeYXp28uDke3VlTRGwBzq70GQTT2Jlsh+HuWzb+yevM7OzP1R8Svl0uIuS/CQ/l6W7ut3t20lB6gYpGlOjC7ejMTWODQEBqyi0Q2lX5mhI51cRFoKetbdbMTZ2W3nKsmTxgfJbZfj5kRIGX3+6w== 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 Ahern 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 04a31643cda3..02a6cff1827e 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 28231e503af9..5e4752131583 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -974,12 +974,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); @@ -988,18 +993,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,