From patchwork Mon May 15 09:33:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13241090 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 F1688C77B75 for ; Mon, 15 May 2023 09:34:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A56E90000D; Mon, 15 May 2023 05:34:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8559E900002; Mon, 15 May 2023 05:34:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71EC890000D; Mon, 15 May 2023 05:34:41 -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 5C3CF900002 for ; Mon, 15 May 2023 05:34:41 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3516DC141F for ; Mon, 15 May 2023 09:34:41 +0000 (UTC) X-FDA: 80791979562.15.36DB304 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 76FBBC0006 for ; Mon, 15 May 2023 09:34:39 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YK2eHaml; spf=pass (imf28.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=1684143279; 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=rlQy53URHQdNMjw6CqxcCkmNsy3hSAEy/OQemY9f+jVHcmLGsjfm/9fQyl2qPWAkK7E8BC 1vzglCvbjpdyJcREtb2mQtKSLyYeHokZm3WVyzhUcM55mO0GI+z3/u6Ee3dfSp+Kv58Tns kTLRHOow3SPAkm3i3mwi0cgq/XIhQ0c= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YK2eHaml; spf=pass (imf28.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=1684143279; a=rsa-sha256; cv=none; b=zD9kqjAmlR8cxOiWm7ejtsxYGpe66IqBIcCMHyOoFH3mSj/qMQgGbff+GWCrig/SaLXqQS fAxu8Vq2J1UGckW3ASVHo6W7XtiBLog1xetRBUf6yKzw2aQpihF+2176+35lg7dylTE5D+ pqMj7PXr7AWmVdmo8ja3/VABcHQVB+w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684143278; 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=YK2eHamlabAMIFIq1IzusvcLPAaiyBcNMI3ZxYwbSXotMlXFqEJxJtfiHMtySYcfXOoJ8B nWXQidCi2GJwLr0U/KFpPgt6lufvee/MCtm7InHhoQbUVOI6nwTnRU9u2GkfD9IzXtpshp avmSEUpX38HR9dCZmPksielHN4cX42U= 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-115-U5XToGkmMZCD_W7I6Y32Ng-1; Mon, 15 May 2023 05:34:35 -0400 X-MC-Unique: U5XToGkmMZCD_W7I6Y32Ng-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 B8275891750; Mon, 15 May 2023 09:34:34 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27EA32026D25; Mon, 15 May 2023 09:34:31 +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 v7 10/16] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Mon, 15 May 2023 10:33:39 +0100 Message-Id: <20230515093345.396978-11-dhowells@redhat.com> In-Reply-To: <20230515093345.396978-1-dhowells@redhat.com> References: <20230515093345.396978-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: 76FBBC0006 X-Stat-Signature: ptpbkthz9ig5x34kkk1h4tksc3177bhs X-HE-Tag: 1684143279-982272 X-HE-Meta: U2FsdGVkX1/wFg2nE9GWQyqYQ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oib28I7Yjkth+mCpQLEeUa49BFGXjN+RsZDxgnrlrua3DEIK12fayV+szIy4mtPZNHI8CwA8UFDZMrrOhQjZGwJS3FU2zZFxqXt3hRIN+g/RuS3pAYchPP/xBwg2kpad0Dam8LqgTQze8bWKK7/UDW+zj4H0PoGYNn0Wo11wtmGnFMBxuAKt99lP0+fXUz18v6B5xrCBtbpNxL3Dt0zUuyja7qj1Ci3QUj/Reemgq4kFBc1ZmE2YnGFfRIVkHgaSjz7ssV8qxwtdV9fdRxr7Cwp25qJxNr1Rc47ifP7DKGvFkY5pcQmPelLaGexVPNqj4upeJX1M1iU+l38Ih+52qSr6NUbYV11v9OoAQK2We8Ub6ctC7L4sVU3HHNlqrTWchRPjEIX9zoEQ== 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,