From patchwork Thu Apr 6 09:42:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13203058 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 E8EE2C76196 for ; Thu, 6 Apr 2023 09:43:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C5D06B0089; Thu, 6 Apr 2023 05:43:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 875D46B008A; Thu, 6 Apr 2023 05:43:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 717556B008C; Thu, 6 Apr 2023 05:43:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 635D26B0089 for ; Thu, 6 Apr 2023 05:43:33 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 44C64161254 for ; Thu, 6 Apr 2023 09:43:33 +0000 (UTC) X-FDA: 80650478706.24.910D629 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 91790160006 for ; Thu, 6 Apr 2023 09:43:30 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HocLaENs; spf=pass (imf08.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=1680774210; 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=c83k4BnXfg8o4jtTDXWGTM6Kn2fXWMyaDkEU8sjy210=; b=o2qnaiZxoZVJ+On4N/Sm8p0DPE3N0vUsYSVvbxEHfgjHdYds8HT7pWFbSgulK4BZE4y6FW 3twjq3AgT3JpOTNr9xSJDBugIKWiQhPiXMKBm3uXoR8BLcoyTpmvf6zFJeYiiP8W5Q/6VU CNwnB2MawhzViyzqDZJAtns9AZB80P8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HocLaENs; spf=pass (imf08.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=1680774210; a=rsa-sha256; cv=none; b=L4WDIiPXnRGkuJzjSWzuNWPtzwZWBqVHqDKTNvVsm1wACKNcBAZ8mBRT6czB6Md09ySXY6 22qJr3eTLf1UjSD+tS/98IY2hCK3x8ej0pXTde8ioJXeQOCjtNUR+mlDIcP420+NrYF6rQ eVCcY0BVDpW2Tf1Iz2R+IdNnmVqemXY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680774209; 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=c83k4BnXfg8o4jtTDXWGTM6Kn2fXWMyaDkEU8sjy210=; b=HocLaENsXNx89RPtVJR7SYa5qFLvNq3/klnY1PTLmpFjjVHu0MS4W13v+JD/aFY8/0DMkQ Xf05egrb1fvSxQ2u08VLTGFnp5x5cCsMZPKNMkkxbL+kxAUNrDxCZvbOoLJSjXywv5WcRQ uQ6NpATSZUSjMF784zS2pZILHK+pgNE= 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-576-TYObJh0zMq67k0lTYOLEeg-1; Thu, 06 Apr 2023 05:43:26 -0400 X-MC-Unique: TYObJh0zMq67k0lTYOLEeg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95B0E800B23; Thu, 6 Apr 2023 09:43:25 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id F305A440D8; Thu, 6 Apr 2023 09:43:22 +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 , Jason Gunthorpe , Leon Romanovsky , Tom Talpey , linux-rdma@vger.kernel.org Subject: [PATCH net-next v5 11/19] siw: Inline do_tcp_sendpages() Date: Thu, 6 Apr 2023 10:42:37 +0100 Message-Id: <20230406094245.3633290-12-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.5 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 91790160006 X-Stat-Signature: jstukigcdr1pto7f9xj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6hMIVLpm7kVr+DqWT4Bgxkrf/1JsWJ5A6dc2eis47nvFtrtT+hCVyo/Q1zfhdyOwxMO/FM88sIJ4bPkgs6CVX/D+IcAOSw8UvToPflGYz8VnLB8cEqohI8lbF0nK8lRmcBhEDrx9E4oQGZRI+6FyKpX7jGjSdP0WhVUS03lxaCXN1bwy4cFVKjXT3Eregw3mSathvAxCi9DeoEcz99+Bw1tQrykaolKg/tyrD4oAl1O730uZsnrN+lsbxuPmoqCQjwJMMTibHTlLyMv6bsuU0WbiOn6XygujbbFdKvfpD8MaaFSTpVGHemZyWLRAezmqs6e973pPUa+sYURzGDihUhivFuFkh+Q6hqYHOHXU/XjNnAR16bhWa1NkrQx5134tjGxO1dEdAu7kqayhtWRtGaGXqJuIqPGjXQNXFM899GCIdeOADdqXpev/HLkVAaM7qzr98GAstSPCKxLy9zpsERnncWDj7WlWT9XYFd+HeCVrOUz+tAfzu1KzAR8MIQMIHCawjxrSS8KNGZ4D9rVaf9aonQ2OEulY/4VB9V4weubKClk9/P0uY5Vv04xER9xswZ+pTCdq3Ayoerofx3chug75jMuOctCACvFqz0BAg== 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: Jason Gunthorpe cc: Leon Romanovsky 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) {