Message ID | 20230518113453.1350757-13-dhowells@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp423112vqo; Thu, 18 May 2023 04:41:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KuziRIK8sUlIZeGkjzNCm56GN40EkVAJz1t5YXxWB/jSsSOK1O4heO+5JAzXZZLLTN7uH X-Received: by 2002:a17:90a:1181:b0:24e:4a1a:3994 with SMTP id e1-20020a17090a118100b0024e4a1a3994mr2274880pja.3.1684410069460; Thu, 18 May 2023 04:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684410069; cv=none; d=google.com; s=arc-20160816; b=sD8uvFMX6hJ5ynIbdlS2JvJcJUI9yHsOSDa0M4nw7bULejT+PqWKnZAthcXQKjKMcC q/MzydNN346tEL/n1WkwDmcyw2dk38QfttPNUj1mo6d5dHJsC7Zx6zVHGUxzkHBFCGmE P3lAvj7vcv2lG7FODwltNXB/0riatuW/4fpmhfA4Wn9ugbJboB2wGhR3BCZhHpKIl+fe 1z9mLk+bgYNHQaen1WvdjDS56odRi+7KljDPqRsZ1tWrzczchmExSj7QBnvT+uy0t4o2 EpDr8RfwT6l8v5gzS7jF/DkNwKvPH2qUed4zSLmvf4uZQGzqQvZNSjP1p+x4kdJ7eJhd nc3Q== 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=5dEuCyEYbAeTLbptDWG+lpG3TePaGyDY6iKA6gIr8Gk=; b=vXj7K8IXfesW1/87tEp21lxSiAVK/OHo202ZSov7izfL7IlLdc3s+z586bCFEl4sFd tVIeeQsGEkk042l88z5phxsSlvkQbGqZ+iaK6eIiYdB0QDJSXy7upWRiZlBxiB5rMUeC z4LVeSNYvUwnwnf5CtvUipHcmh50bhtF/PFnd3XVDMK0Tnm+Tw+rpRXf1USiuyRD8+Ow /miIac4lMgQGyZauVGvpZRR4uTOxv4WVX4ZTZ4LuC8LNj593lycfwYDFmPE0MJKiuEHL OhZh4Hf8amQAMBPvlTMkeOKX/a1CZS1StiVtx6s9j0i9/NKRwxMUBANfAOYxMt6pXX5E h8ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WggRO0We; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi16-20020a17090b4b5000b002475b063d35si4494320pjb.142.2023.05.18.04.40.53; Thu, 18 May 2023 04:41:09 -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=WggRO0We; 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 S231514AbjERLhh (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Thu, 18 May 2023 07:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbjERLgs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 18 May 2023 07:36:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EABF19A3 for <linux-kernel@vger.kernel.org>; Thu, 18 May 2023 04:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684409759; 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=5dEuCyEYbAeTLbptDWG+lpG3TePaGyDY6iKA6gIr8Gk=; b=WggRO0WeP/jLRWS4qJcthCtGl5EnVDsPr7ZeDxf2eUtHCkibfunl7zHUzk3Vh5oUNbOf5I zKvpF+RjKEVz5Ytqy51sSRM8MVr5e1qgR2wW6u/+4b8VE/nMbY0Oy3EtXSq3u1OK6Rk+41 Ss0zy4q9aa/LZc7PHUS2d/5MEMPYjdU= 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-668-jwZ3dLuJNq-_aRCVShqxqQ-1; Thu, 18 May 2023 07:35:54 -0400 X-MC-Unique: jwZ3dLuJNq-_aRCVShqxqQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7959E86C60C; Thu, 18 May 2023 11:35:53 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D35614171C0; Thu, 18 May 2023 11:35:51 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: netdev@vger.kernel.org Cc: David Howells <dhowells@redhat.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemdebruijn.kernel@gmail.com>, David Ahern <dsahern@kernel.org>, Matthew Wilcox <willy@infradead.org>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org>, Jens Axboe <axboe@kernel.dk>, Jeff Layton <jlayton@kernel.org>, Christian Brauner <brauner@kernel.org>, Chuck Lever III <chuck.lever@oracle.com>, Linus Torvalds <torvalds@linux-foundation.org>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH net-next v8 12/16] ip6, udp6: Support MSG_SPLICE_PAGES Date: Thu, 18 May 2023 12:34:49 +0100 Message-Id: <20230518113453.1350757-13-dhowells@redhat.com> In-Reply-To: <20230518113453.1350757-1-dhowells@redhat.com> References: <20230518113453.1350757-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766231972736918683?= X-GMAIL-MSGID: =?utf-8?q?1766231972736918683?= |
Series |
splice, net: Replace sendpage with sendmsg(MSG_SPLICE_PAGES), part 1
|
|
Commit Message
David Howells
May 18, 2023, 11:34 a.m. UTC
Make IP6/UDP6 sendmsg() support MSG_SPLICE_PAGES. This causes pages to be
spliced from the source iterator if possible, copying the data if not.
This allows ->sendpage() to be replaced by something that can handle
multiple multipage folios in a single transaction.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
cc: David Ahern <dsahern@kernel.org>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Jens Axboe <axboe@kernel.dk>
cc: Matthew Wilcox <willy@infradead.org>
cc: netdev@vger.kernel.org
---
Notes:
ver #6)
- Use common helper.
net/ipv6/ip6_output.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 9554cf46ed88..c722cb881b2d 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1589,6 +1589,14 @@ static int __ip6_append_data(struct sock *sk, skb_zcopy_set(skb, uarg, &extra_uref); } } + } else if ((flags & MSG_SPLICE_PAGES) && length) { + if (inet_sk(sk)->hdrincl) + return -EPERM; + if (rt->dst.dev->features & NETIF_F_SG) + /* We need an empty buffer to attach stuff to */ + paged = true; + else + flags &= ~MSG_SPLICE_PAGES; } /* @@ -1778,6 +1786,15 @@ static int __ip6_append_data(struct sock *sk, err = -EFAULT; goto error; } + } else if (flags & MSG_SPLICE_PAGES) { + struct msghdr *msg = from; + + err = skb_splice_from_iter(skb, &msg->msg_iter, copy, + sk->sk_allocation); + if (err < 0) + goto error; + copy = err; + wmem_alloc_delta += copy; } else if (!zc) { int i = skb_shinfo(skb)->nr_frags;