From patchwork Thu May 18 13:07:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13246761 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 A4B2CC77B7D for ; Thu, 18 May 2023 13:09:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42A3A90000E; Thu, 18 May 2023 09:09:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DA90900003; Thu, 18 May 2023 09:09:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27B4B90000E; Thu, 18 May 2023 09:09:14 -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 1326F900003 for ; Thu, 18 May 2023 09:09:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C9BE540846 for ; Thu, 18 May 2023 13:09:13 +0000 (UTC) X-FDA: 80803406586.13.DE7AAE7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 539794004F for ; Thu, 18 May 2023 13:08:15 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hzAxwfjR; spf=pass (imf04.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=1684415295; 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=FkLIsuWcxLdm5m/RLKw/6bFEvudw3Dbf8/jbJKlIa0s=; b=iaJ8XXeH7swEF+QH3XDMW5dUgIVUXaXq74C99KMZ3mwvRjZZlFtv5d1LFlJtHsJ8KLJlSz ubsBtCtDRhzjgWIB4Ix/CkRndgQ7BZrXEcjGlXin2fNin8jJKSsamINkflo0E9uD+fuCL3 KanW5zy4fAH2uulHE1VtBmzURZCBiS0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hzAxwfjR; spf=pass (imf04.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=1684415295; a=rsa-sha256; cv=none; b=uCYDPvcyXwKJnLIeY7iZjv58w9EF08M5tDPzL6p2NOYknBCQQcSWIMMAkVgN52VMBWTnG6 ieIt8m1wYfPWjXmzEdoWqplsnXTPUbLpwmrMRIIKphVZzQzcJlFTNhU4mK2bw/b7OVclaT 5t+YbLr8si4O47M1ErebOGCfKdNFsUg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684415294; 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=FkLIsuWcxLdm5m/RLKw/6bFEvudw3Dbf8/jbJKlIa0s=; b=hzAxwfjRfrKPHQz6EigEiQWKCeE40uh2UozJPCm54MMfb0j1GM5jLs6zr7gH10GoCGQ54l ikXADZNUGpIGkpdKXx3B8fN+x8nNp7drGuFM+JVlCLPW8JI9JOAXEirOlYfebiQxu02TZn T1EZF42oApjSzwOli1pewmto/TwIOB4= 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-459-_LTtSiUiMLObar1uKYQXhg-1; Thu, 18 May 2023 09:08:08 -0400 X-MC-Unique: _LTtSiUiMLObar1uKYQXhg-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 594D0857DD7; Thu, 18 May 2023 13:08:07 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id A93852026D16; Thu, 18 May 2023 13:08:04 +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 v9 10/16] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Thu, 18 May 2023 14:07:07 +0100 Message-Id: <20230518130713.1515729-11-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-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 539794004F X-Stat-Signature: 1gdws7gzxjtj58rwehrie7ytxt7drkto X-HE-Tag: 1684415295-795023 X-HE-Meta: U2FsdGVkX18hAdK+VBARYm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Ze9YLolHO+LcDb5cZeLY1OK/SsrH9WELjxksrOgWR0vAerF5QpsB57VRhia5FbFduBzMTFJ0NhYYTu8eBiKvmRCFWTWiZiXV4a258MIpxQHi1cgiye3c0i++9yY11WM870eDAjONXChdRX/UsWcoVNKBlbFw+znVaa4PN0Tw66Omvq1Z+YuaIVyLa76oBAQ3HTF8oRBajqayfG5U7vXHeAIMfyvxlp4K2n4NDUwniri6NJYh3U2jzonQJT4J+YcsXJ5R7GJV/A/C3ItGh9hfrfnCE8KdTp/niu+ERlPSHuPtDIA2N5EDVN7BVOu/iRpv1A3kwIz7pNeWcQ9fzjVtsP2iAz8wWOsBjxNjG9rBqeoocvs2Ey0SNwX6l+YufKHg4i1K15vgIpIutax0tsglZAQ== 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 f3a0c02678e0..e9506cebecce 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,