From patchwork Wed Apr 5 16:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13202265 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 990A3C76188 for ; Wed, 5 Apr 2023 16:54:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BC686B0085; Wed, 5 Apr 2023 12:54:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 969826B0087; Wed, 5 Apr 2023 12:54:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80A746B0088; Wed, 5 Apr 2023 12:54:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6BDCC6B0087 for ; Wed, 5 Apr 2023 12:54:28 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3480C80810 for ; Wed, 5 Apr 2023 16:54:28 +0000 (UTC) X-FDA: 80647935816.12.074241C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 6CE9BA0016 for ; Wed, 5 Apr 2023 16:54:26 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Eng3yHgc; spf=pass (imf15.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=1680713666; 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=pP5V7G7GRqo/82ZWWApO+0CTJP1pdqvbg0H8r7V6l6c=; b=WpxtVz7WxdK5KNpXJw4PR2srNlSa+2Smjdlg7oQDDucMLDszpnsTC2q5EyJSaFT8RIXYOH a0A8BsmYqvxA+OzuceLe6UcR4QDVCzACQssjsl5vALTTD48kdprTkej7LxFmb2scKV9ZhS S0WCb17W5N4ProjVaaxdHlo3YOZjuPM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Eng3yHgc; spf=pass (imf15.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=1680713666; a=rsa-sha256; cv=none; b=CHRlX4AC0DxGvo/ctcCEVi+qHg5RsdEwXUgX9ljRgssPCFCOmRXGWqoqAIZfQBGAQ0OyZy RAwzEs947M5wVp/9VCPUJqfbOEXetzZISMisSPG5e+J4HoSlDtjIFxv6QEDmZx6T8unePQ jSXJQXp5X3b8tdTHm0IYA6oD+xVMBFM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680713665; 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=pP5V7G7GRqo/82ZWWApO+0CTJP1pdqvbg0H8r7V6l6c=; b=Eng3yHgcfAuQ02ojazpM+W/HudjSPJJ7ZXgRrO4fDQaoIGFY3hq9kjc5mkg3X/RHhQ2sVR 20WWJZ3Ywr6se6rtWGvK0cP/50fv2hkVH/4ZsqE4byqTnvQA81po6jIZ2z40PRR9E9GQOa 21VobiXyBH4rDesSIk/j+PSP6E/1mkI= 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-523-jkYT3UqJN2e1IEz58PiLDA-1; Wed, 05 Apr 2023 12:54:21 -0400 X-MC-Unique: jkYT3UqJN2e1IEz58PiLDA-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 6F2AA3823A07; Wed, 5 Apr 2023 16:54:20 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 227C72027061; Wed, 5 Apr 2023 16:54:18 +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, Bernard Metzler , Tom Talpey , linux-rdma@vger.kernel.org Subject: [PATCH net-next v4 12/20] siw: Inline do_tcp_sendpages() Date: Wed, 5 Apr 2023 17:53:31 +0100 Message-Id: <20230405165339.3468808-13-dhowells@redhat.com> In-Reply-To: <20230405165339.3468808-1-dhowells@redhat.com> References: <20230405165339.3468808-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: rspam04 X-Rspamd-Queue-Id: 6CE9BA0016 X-Stat-Signature: pxm7p7ixas11xknidexb9ws165cx43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CBXIijtassLoYRbMjaOVPausn+/hmakPcKOBqw8qQPOLH+JIqe2+UTUFzdV8ghZFnv6o/fL29Q3R+/LnRhGA3VVlFpoO/dWawsksc8wMthyyk5Gztud6r6qv85H9oXW3nQwXMZ7ko6Qu49PEXH/0cBeAzdfpqQM06y9x3Fz+cpFOHPJhRxwabun9LAlGaj+bA5zBs+65AaUHirGUDWtxRsFeLGfgGpjmlc7pWz8q6CzSqy/2ZUbbhV8pPhJ3Ub7inVwjna9y0zBq5zcMxH2DTL10tMvkeN5gLXd1LyEnW6Te2rxoz+rWCpMhwvcveuKQLVyrUY1z8jZHmWxAWB+UW9ZmWnMWD2s/c20bTIBoZVs9YRnHsJ0GlwOcPrWCMGDZpmME8mPkBbBV0NEWKIuz6NLnD0zZMV8fTGW5JYY0Ykdcpq8V5figNKH4vQ0Z3uLHxv+jUuYibZceH6/2FU30/xKFcpWzLVG58TgpPfF6HaO3QC7PCJqa0W+R3yOP5EuNgN6iCdeuMLWxIk+mOsJnKU8sSRSw== 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: do_tcp_sendpages() is now just a small wrapper around tcp_sendmsg_locked(), so inline it, allowing do_tcp_sendpages() to be removed. This is part of replacing ->sendpage() with a call to sendmsg() with MSG_SPLICE_PAGES set. Signed-off-by: David Howells cc: Bernard Metzler cc: Tom Talpey cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: linux-rdma@vger.kernel.org cc: netdev@vger.kernel.org --- drivers/infiniband/sw/siw/siw_qp_tx.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c index 05052b49107f..fa5de40d85d5 100644 --- a/drivers/infiniband/sw/siw/siw_qp_tx.c +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c @@ -313,7 +313,7 @@ static int siw_tx_ctrl(struct siw_iwarp_tx *c_tx, struct socket *s, } /* - * 0copy TCP transmit interface: Use do_tcp_sendpages. + * 0copy TCP transmit interface: Use MSG_SPLICE_PAGES. * * Using sendpage to push page by page appears to be less efficient * than using sendmsg, even if data are copied. @@ -324,20 +324,27 @@ static int siw_tx_ctrl(struct siw_iwarp_tx *c_tx, struct socket *s, static int siw_tcp_sendpages(struct socket *s, struct page **page, int offset, size_t size) { + struct bio_vec bvec; + struct msghdr msg = { + .msg_flags = (MSG_MORE | MSG_DONTWAIT | MSG_SENDPAGE_NOTLAST | + MSG_SPLICE_PAGES), + }; struct sock *sk = s->sk; - int i = 0, rv = 0, sent = 0, - flags = MSG_MORE | MSG_DONTWAIT | MSG_SENDPAGE_NOTLAST; + int i = 0, rv = 0, sent = 0; while (size) { size_t bytes = min_t(size_t, PAGE_SIZE - offset, size); if (size + offset <= PAGE_SIZE) - flags = MSG_MORE | MSG_DONTWAIT; + msg.msg_flags = MSG_MORE | MSG_DONTWAIT; tcp_rate_check_app_limited(sk); + bvec_set_page(&bvec, page[i], bytes, offset); + iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, size); + try_page_again: lock_sock(sk); - rv = do_tcp_sendpages(sk, page[i], offset, bytes, flags); + rv = tcp_sendmsg_locked(sk, &msg, size); release_sock(sk); if (rv > 0) {