From patchwork Mon May 15 09:33:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13241087 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 406DEC77B75 for ; Mon, 15 May 2023 09:34:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D39ED90000A; Mon, 15 May 2023 05:34:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE980900002; Mon, 15 May 2023 05:34:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B640E90000A; Mon, 15 May 2023 05:34:29 -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 A4054900002 for ; Mon, 15 May 2023 05:34:29 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 72EB78134C for ; Mon, 15 May 2023 09:34:29 +0000 (UTC) X-FDA: 80791979058.06.884CCC5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id A0E744000A for ; Mon, 15 May 2023 09:34:26 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ebtoFHUE; spf=pass (imf11.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=1684143266; 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=tYeoTX9B8dad49qWPHePVLYzX6oyR1jBlVymL6Q5Zsc=; b=01BWh9E5+5H6ybEWtq/RRMmSP9a3tSQtRXkjJXipYDdc2NS8Wh/ynktY1gzJF9efPDTrvL DUJR7/YzsK0U8IeDdtrbqzfKy0Syp425cZNthWzXTCTg0B+IsEvJ/NRQZTTKJjuxZ8ngbd tpjhUv1pz2XeES8cLE9JOfN+lmJBL6g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684143266; a=rsa-sha256; cv=none; b=8YPFUYzch/lrWp0AUPurTMcBu+JwRPR4DeXdJyPA+obUcDCJ3BCMh0/0N4HlUe7p8KCsYn cV3Va47VZlibHwUa3TBZuGRtQRtN3q7pIusC/9LR46h+PHTztq4F8rGbeliSH13IdZE1Qx glydl4LOKkn6/YFbQXlujFV1Q2JgVsE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ebtoFHUE; spf=pass (imf11.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684143265; 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=tYeoTX9B8dad49qWPHePVLYzX6oyR1jBlVymL6Q5Zsc=; b=ebtoFHUEUwWYqmdixBBOfQNOz1rh//p0kJZPIQVAGTYIGh62n2y6w1n8opm24/fe8zUyAT JZLmS7j9n9Au+qWzzjdbhtIkn43lGWzPDw1UJlmdEnEFEpqwI6Vb65un9Cn3ubxpiMz0Bd a+FfVJU/bjLoSqQibgrpW+h6jYhPn6Q= 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-640-1nXxZzOvNO2kG1IIBR_aRA-1; Mon, 15 May 2023 05:34:20 -0400 X-MC-Unique: 1nXxZzOvNO2kG1IIBR_aRA-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 BFE803C0D858; Mon, 15 May 2023 09:34:19 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9CE063F3D; Mon, 15 May 2023 09:34:16 +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, Steffen Klassert , Herbert Xu Subject: [PATCH net-next v7 07/16] espintcp: Inline do_tcp_sendpages() Date: Mon, 15 May 2023 10:33:36 +0100 Message-Id: <20230515093345.396978-8-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.5 X-Stat-Signature: gzi7rkhwn1fz5iryoy9km4b15xjkdtty X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: A0E744000A X-HE-Tag: 1684143266-330310 X-HE-Meta: U2FsdGVkX19gM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lg3sFfgw0SzValfvcti0/AIs4fRjXJWmblnN7ZdaxiZg5LMaDIpXVRXxx4+dVNUtubP0FLPqxZOEI1JOz7tz/2jby5daIzmz0euWnLcVvCX91C+oO4Cd0UjFTsOtKBR9YVRqS8Bn89IQkvM0TDSkMn8fOaU66j1YlP5AZ7MFwXo1pUPswtkJgyMswP6TchmdrrQUHLpNS9iThRce0BYIQddIclbeoD1FxI9ru4GeJ06kIu8VHgoqTkVS+SfL6paeLjedqs0eRx5lSrYoFP2vTXEA0itg6sai/HBD4w3oRxJxWYrJFWbyfs/Z/P3/gStmu9e0kXcfcaSK6XJAsVNhzZ+meR/S1EL/qsn8lZv/JYehMAGkf6z6Ubd8fsQiw1O0Ra+WtaSbsynIEDD45+RY6ZaXexfnS344slUL6PqZTkYwx1P+FZMdvc0u9rO1a0vfP/q+8OT73IEHZP8hL5RJm9Qkrz+fpL+tPiPcCT76Q3ty716oUWVfqd1AxeXUkfoAg= 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: David Ahern 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;