From patchwork Tue Apr 11 16:08:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13207820 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 37BBFC77B74 for ; Tue, 11 Apr 2023 16:10:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 778BF90000D; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D98390000C; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 552B690000D; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4326C900002 for ; Tue, 11 Apr 2023 12:10:03 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 05F48120D94 for ; Tue, 11 Apr 2023 16:10:03 +0000 (UTC) X-FDA: 80669596686.09.807D0D1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 125031C000C for ; Tue, 11 Apr 2023 16:10:00 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fW7FwjWH; spf=pass (imf20.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=1681229401; 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=WkdEEEXdr/3qYwqcKdd5Ao06l5CmC0hih/jlnjAFNWQ=; b=VXVjzN08Z3t/EeEZXYLRqNvSNzTpr3IY6dlpwwnX1KYrrnDB/+IB36aCqYZGg0usY3lTn6 3KVp/2sTw4Mv3PYcghkDPWsj3Pf7TNw6XPA5E3vZ7OIhae7xKbbUZTgFjFtddIPrIUUXC+ iFezjqpOkHAzIJe1vX6FwyyeOqxoaaA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fW7FwjWH; spf=pass (imf20.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=1681229401; a=rsa-sha256; cv=none; b=CvQtNYH6Q08WjCMu9nwdSP1StULWVTIWVpdY3gfuBak0i1tGdiyj2pNkQVeqtlfWpgDdvv e9S9FFohIzOyiLYKGauzwvn0rwYb1507ZAIMdf7sKnkOMlMOld8wIhjJ9DhqV8xXOGPMjr qtgx27Ao++LRbfL8oP0iBWZq7huv13c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681229400; 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=WkdEEEXdr/3qYwqcKdd5Ao06l5CmC0hih/jlnjAFNWQ=; b=fW7FwjWHbTX0vrMWciM4WxtstED6IYg0dTM9/IHNAp/UvOD0ndCngkEdFjQLnLVeWp0gWO KEl84czKk1sKSwI9kAVs2bzLyxtUghL9hbqyVwdImLCujopHqsziVBiMGaagDVAbfJyLe4 ku4U/H1NWxY6WB3dFEjSIlUaOumaQis= 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-74-AxOMgkEwP0O6PEpafr2joA-1; Tue, 11 Apr 2023 12:09:51 -0400 X-MC-Unique: AxOMgkEwP0O6PEpafr2joA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 340FA38149B1; Tue, 11 Apr 2023 16:09:50 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1948C1121320; Tue, 11 Apr 2023 16:09:48 +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 v6 13/18] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Tue, 11 Apr 2023 17:08:57 +0100 Message-Id: <20230411160902.4134381-14-dhowells@redhat.com> In-Reply-To: <20230411160902.4134381-1-dhowells@redhat.com> References: <20230411160902.4134381-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 16trah56shuwef8syikqet7rjmtjzh6w X-Rspamd-Queue-Id: 125031C000C X-HE-Tag: 1681229400-683018 X-H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3PuEC1ZngdpYGbuDo8myXmdUkcar0tXUt0iZbs+NF0ayrkapDqjXMz99zpV/fe7Mfo1bSTXvqrwkGcx/Gh5XIJdjztR5kcTpn5KI+n4+efofYR1rHQz0k8ysu6y5vDSxYzuJLILA/y9LhxmR4QkbCCi4QZ3OkNIEzNiKdZyFsoNqTkz7J61knk9SXlAMxjiS+DUM4Xfbqzf3DTl18ZaGKu1i3WJDvKMXwvWSSlKDbwHPiYlRhUlSMggQoHuq2YpVJ4VygYKsX/ghU+U9fm7EPKVfTPtjfKojVGw2fd4PKOrvud1P2pzUO8eGTyUMaeaHeridYcU4hCLb2FO6cgGbBiwF4zY3GyBxHBnmnDBX8z3TDbckRR5WidkW0XL0v/GgY7uDmlkvy7KCIrLmVmgpgENKi4FFE3PYXLR1a+EDx31Np54aJP 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 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 0187988514b1..8f39e6024768 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,