From patchwork Thu Apr 6 09:42:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13203059 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 B0352C7618D for ; Thu, 6 Apr 2023 09:43:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51C2F6B008C; Thu, 6 Apr 2023 05:43:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47EC26B0092; Thu, 6 Apr 2023 05:43:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36CC96B0093; Thu, 6 Apr 2023 05:43:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1A6516B008C for ; Thu, 6 Apr 2023 05:43:35 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DFFB31C5DFB for ; Thu, 6 Apr 2023 09:43:34 +0000 (UTC) X-FDA: 80650478748.10.C2F8F2B 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 4D2331C0009 for ; Thu, 6 Apr 2023 09:43:33 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=anuwtPGl; 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=1680774213; 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=RHjrbnbFl1QPUSYdPKMdHAGAsNDTVNQC0aaPP3HcXyE=; b=Oa0aGbZCGrivyjNch+UPWAgyBhZpp+Kw0xwYkAvpqta1BrSTCz05ZF3MTjSzlq+7qZ96v4 R7dONDa2Vk6zHqFTgpB4oLpuX/E5szfGFVquCoxHQQ3e4xluZnhQm95+yRTpRBgFO+mUbG 6Pe5L3gOX7H7SZ2JqS0oD+OKQsFrA0w= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=anuwtPGl; 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=1680774213; a=rsa-sha256; cv=none; b=zQ9jQRfIMYFcaa+xAXZYlrmmGxOX2gH1xqBsEf/oHlObuGisH+t75EBlkTnHA2Ichc27qz ODw+PKLfXFxMx/LWJWlbGRNqPIfntLmgEwz3OFHFWoj47dM8MinUYSnTgZO+uaYXCXJEmf lMGWfO460/roCI9uL3B/ArU+s5N+Uz8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680774212; 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=RHjrbnbFl1QPUSYdPKMdHAGAsNDTVNQC0aaPP3HcXyE=; b=anuwtPGl+SmWOPDRopO81v8ue9p9nJuvNhVXrXaqVKsGfyJNiUUZ4kTgVn54rIqwNJeHU2 zGV+xu/2vPMcergvBjdBnjUWQeymTX/vfBQSJZf5/S64ZKhpi7Wy+uy0HAEc+wOLjV+gV0 7nVQ1BR8t3OaUgMzMv29Cj/58IOd8FE= 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-262-3gYCWEu5OKKN3foGZGQGOA-1; Thu, 06 Apr 2023 05:43:29 -0400 X-MC-Unique: 3gYCWEu5OKKN3foGZGQGOA-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 5B8D8101A550; Thu, 6 Apr 2023 09:43:28 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AEF240C20FA; Thu, 6 Apr 2023 09:43:26 +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, David Ahern Subject: [PATCH net-next v5 12/19] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Thu, 6 Apr 2023 10:42:38 +0100 Message-Id: <20230406094245.3633290-13-dhowells@redhat.com> In-Reply-To: <20230406094245.3633290-1-dhowells@redhat.com> References: <20230406094245.3633290-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: 4D2331C0009 X-Stat-Signature: 7xa3qf9hdxg34pxr1x7n8xdx158a8ygq X-Rspam-User: X-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RGAtuSlD5j58fPFZNlI8GIb2cYtNOyRkdkPQnb5LpImgR4/zxVlCCFE8CW66iVE5jdLIP6f4IBs6Uk7Fz872uRifPaUpfT88mvjS9R5v9N5Jngz2Mp3atPF7Z7+oH6H17mkxVjHE06M5Y6iluO0LuvZQDVjR9apFEGcG4FWNc1gcYYzMdlPeSLouiqQ/KaNP/H/NDJmGUigFftxlkr1Od+hCDieehwjNTEZpPqIcEd3FZI8IPhtl7wZUpG81WqAG6OHVgokDv7W/a52cGU77wyq94iMHifpgG9y4VP8VWzL+3mrWhAoPE8LM50xSg2+BROFzrjxa6u9dEyEHlin1WjzTWvLiay9ejIrD8hYX7nxlD9dBLlUApS5V3dqHzUmARmf+kH9XhPbNECEeoiYORkNkdZPpNinSJsb2FwggQox9x8StU2TVuPl/Ies5z4TFPoG1/nMGowID6 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 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,