Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5731931rwl; Tue, 11 Apr 2023 09:12:38 -0700 (PDT) X-Google-Smtp-Source: AKy350biJ79I8P+vzywCeP+ryp4GKstn4DNJUMUY1B/LoLxeF5PAwQ7OhogZIB6fqK4DMHlIz/ut X-Received: by 2002:a62:1a8d:0:b0:636:f899:46a0 with SMTP id a135-20020a621a8d000000b00636f89946a0mr7852897pfa.15.1681229558219; Tue, 11 Apr 2023 09:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681229558; cv=none; d=google.com; s=arc-20160816; b=WM37pQEvQtGxCOaEfOtQHcFLUK5k4hVuidxYIpImOVrRZVDB+TS4YeHJ7InsxJevaI zr1bZohE5ZbTGBkIMa9whVTQILFmswiTx1RFj8JyOKaZGBWqhP0kmYAByVSxjYFRywTR 9w8LQYdiFY+frInP8LhrrfC6SFUdX2SutlMf84k6os1AcIrLfO2zMI+EZFKHoajw9oZc yhTuYAL9gzMd4w6Xyf/tg8LMQm98VeFnjKX0jUaYVKpbcTpHajEkbUOgb5AXDv58lRRQ ZL74KhPL11MTNEWPKc2fdEnmAbS/t2X67/8Mc/gYEYGSEyMhakUJmZ01UIL0W6mv4haL F44g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tYeoTX9B8dad49qWPHePVLYzX6oyR1jBlVymL6Q5Zsc=; b=WIRUNcFHkaXyN2XtcwiFNtq0aNoykUyBSGecSqJ5bhfMkSsM5hUGF37rIaNAxpscap DkIB8AfcIjJNTkO6hXTbvt1cACIdWFoOdvcE4BALAYLGcHNUAFl/55SpJAWi+2Ed6jI4 ++Ewu7qO+LBTo8TLKKJCxy+oQnEP/6tgE/d79DBMkmwSFKTSdvxxbBPDjP97ufMXOTUP 10y/KR0+Bya6YsYIeNq/eHSXv5zLF8XQXYx9/YHftQ7jKE7oJqtI/Thn6fUHmyCLUmvA pYXtXW7geSOzHI+YUKFMamjAjC0UZHxE+gZdtDeAfmsBl7mCKEX2yec8JsjiPdcq9AZz 4c5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=evMaWQJR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020aa794ae000000b00636691b36aasi6933933pfl.96.2023.04.11.09.12.26; Tue, 11 Apr 2023 09:12:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=evMaWQJR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230447AbjDKQL3 (ORCPT + 99 others); Tue, 11 Apr 2023 12:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjDKQLD (ORCPT ); Tue, 11 Apr 2023 12:11:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576784EDF for ; Tue, 11 Apr 2023 09:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681229383; 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=evMaWQJR2NowjRriRwFIwimhbgxu1Ckwxg7TCRB/TYbWCp8Q4QU7RII2ariyav4AqT0P3i 2cdQQCZO/k4Tpm1qTrvZBNYgT33ln2rIBq46FNyHYO+04tQ1qQxIpwZMXm3C5xMa0+5Vsm MjsfCSDMKSClaf1nJwPkUD/XGQuD1JU= 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-77-UXK5c0oIPSW0QoQ1NoAdzQ-1; Tue, 11 Apr 2023 12:09:42 -0400 X-MC-Unique: UXK5c0oIPSW0QoQ1NoAdzQ-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 16E3B87B2A7; Tue, 11 Apr 2023 16:09:41 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6348847CE1; Tue, 11 Apr 2023 16:09:38 +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 v6 10/18] espintcp: Inline do_tcp_sendpages() Date: Tue, 11 Apr 2023 17:08:54 +0100 Message-Id: <20230411160902.4134381-11-dhowells@redhat.com> In-Reply-To: <20230411160902.4134381-1-dhowells@redhat.com> References: <20230411160902.4134381-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;