From patchwork Wed Apr 5 16:53:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13202264 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 B2120C7619A for ; Wed, 5 Apr 2023 16:54:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D82D6B0083; Wed, 5 Apr 2023 12:54:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AEB66B0085; 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 377436B0087; Wed, 5 Apr 2023 12:54:28 -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 2708C6B0083 for ; Wed, 5 Apr 2023 12:54:28 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 090D8141139 for ; Wed, 5 Apr 2023 16:54:27 +0000 (UTC) X-FDA: 80647935816.14.1199AC2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 10FB8180010 for ; Wed, 5 Apr 2023 16:54:25 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ajuQZvkL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@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=DjALLcCTAkJ9GFGzQm0mxszTSA2UBcCYteYf8nsJBJs=; b=z2plNB1n63mREhbws34JfF7dfrx4skjXIU+nHQ/E8kUpBo4xABKuS7Oqn2Yq309+fU68KM cHLrzDkVV8gVymPkUZvqZGha5r02P/WBT0U6H2s73jzSG/eYrJBBkx+u8muDiPzDVMfphM Y0u4xLeo4RdC2QbLMmD6uCSAuJe1fT4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ajuQZvkL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680713666; a=rsa-sha256; cv=none; b=53OV0Kbc3FVNcYMLu7wdNqpcZqKLiUrLfCJ8/ED1a0dnRi0Mrw8f8lF7t+wb29zvmj5/x1 PykjF0HsWvKQ43vMrStPT5S6Xu/WVtA8mErEsgtb9pD6BCIqshUKcm+lu7iJzy+Xl31EDo nJb3lJ075smz31M6Eealx8pDahVYy4g= 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=DjALLcCTAkJ9GFGzQm0mxszTSA2UBcCYteYf8nsJBJs=; b=ajuQZvkL0V2yuCvVzAZrd7sryW1j1Ve8tkThDdH6wV8p228RRL+n236n5QaetNRs5QGJbS oxC4BiNm+AnXn0v+rmnVpl6s0RRkBhtd5MoL6YTGzaQA31d2+YPR3oa2Lg31aj4yA/uYfX wq6mrXIusVYfqc1G10zI9YxdmQtdemE= 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-561-cGYh42d-MymHRdF7Qm9tVg-1; Wed, 05 Apr 2023 12:54:23 -0400 X-MC-Unique: cGYh42d-MymHRdF7Qm9tVg-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 9C29F88904E; Wed, 5 Apr 2023 16:54:14 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C0AA18EC7; Wed, 5 Apr 2023 16:54:12 +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, Steffen Klassert , Herbert Xu Subject: [PATCH net-next v4 10/20] espintcp: Inline do_tcp_sendpages() Date: Wed, 5 Apr 2023 17:53:29 +0100 Message-Id: <20230405165339.3468808-11-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.5 X-Rspamd-Queue-Id: 10FB8180010 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 9ma8setd3ie5hdcskutb8eqo7b7cybj8 X-HE-Tag: 1680713665-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k2Qdng7ZlejfIwqTbiZPUS8qkuYYjRmmTGMGw22m7nZavHrYVp0C+PRiJlrXZKBvxCmO2yTZAyLi+IboZSX54r5LZf7pyHZEufYDhO/Ra/TVFvjOh8nUWrrn0PPqGFazfhDmeRJTbDmrC809DUWFuwtYzfZKJTG+1W5RAoyFKSqsJV/Dzwt40Wcen/JRQwFdXtnsw2ZCt1qfUFZVd8I/i3Gqn10v2bTUZoPeyM/cFx43T5AuoU1461Bmy94vGC71ddGEOfQXbjof65v1AtbXoYVTvYrb1j6g9NphOhISLN5DhIS41/axAE4Udh4cLqXaaMKf8V10bZJSRJtkD8le5XLPWNdQQqNjcLQokiDUrjpsiq0qpn9NUE83R/jUCoXSlT7RC7M0lAyUTK1DgjI8zWcBGJyv7V847Hn72zCF3Rv61moLVfuzm2NabeQbYAiIMVRNk5kAbqNiswz52llfCtfT4xikhDUkHnn0GajFCBNgbxBIoEQmEH8Ks9/pNRTtu1B0eQo8To56ahLfLPpcwZgAB56WQvScR41Hxw== 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: Steffen Klassert cc: Herbert Xu cc: Eric Dumazet cc: "David S. Miller" cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- net/xfrm/espintcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/xfrm/espintcp.c b/net/xfrm/espintcp.c index 872b80188e83..3504925babdb 100644 --- a/net/xfrm/espintcp.c +++ b/net/xfrm/espintcp.c @@ -205,14 +205,16 @@ static int espintcp_sendskb_locked(struct sock *sk, struct espintcp_msg *emsg, static int espintcp_sendskmsg_locked(struct sock *sk, struct espintcp_msg *emsg, int flags) { + struct msghdr msghdr = { .msg_flags = flags | MSG_SPLICE_PAGES, }; struct sk_msg *skmsg = &emsg->skmsg; struct scatterlist *sg; int done = 0; int ret; - flags |= MSG_SENDPAGE_NOTLAST; + msghdr.msg_flags |= MSG_SENDPAGE_NOTLAST; sg = &skmsg->sg.data[skmsg->sg.start]; do { + struct bio_vec bvec; size_t size = sg->length - emsg->offset; int offset = sg->offset + emsg->offset; struct page *p; @@ -220,11 +222,13 @@ static int espintcp_sendskmsg_locked(struct sock *sk, emsg->offset = 0; if (sg_is_last(sg)) - flags &= ~MSG_SENDPAGE_NOTLAST; + msghdr.msg_flags &= ~MSG_SENDPAGE_NOTLAST; p = sg_page(sg); retry: - ret = do_tcp_sendpages(sk, p, offset, size, flags); + bvec_set_page(&bvec, p, size, offset); + iov_iter_bvec(&msghdr.msg_iter, ITER_SOURCE, &bvec, 1, size); + ret = tcp_sendmsg_locked(sk, &msghdr, size); if (ret < 0) { emsg->offset = offset - sg->offset; skmsg->sg.start += done;