From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35441C6FD1F for ; Wed, 22 Mar 2023 13:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjCVN56 (ORCPT ); Wed, 22 Mar 2023 09:57:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231193AbjCVN5u (ORCPT ); Wed, 22 Mar 2023 09:57:50 -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 76F875ADC4 for ; Wed, 22 Mar 2023 06:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679493389; 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=tlkU0aouTlTQZFDVtuWFhmIKzkQiazGMv/slr0zGp6w=; b=eI4A8ZKde9NNxkvdaNO92h77OViBiaVqEGDB1qZVn+SAOw2A1bg2e0WOrxw2Z49RDoEIVf jLySw9Qg1dXFS/Igr6Q/jUA11PyoB593XWFT41rftGLEwIQCrELJ/buYoWNvbf8PveYuEF MMAL3R5EaQQXvPKjYmY3LGEVdll1xL4= 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-635-4QPjJOlYPaSIfyKEej3l5g-1; Wed, 22 Mar 2023 09:56:27 -0400 X-MC-Unique: 4QPjJOlYPaSIfyKEej3l5g-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 A44BA85A588; Wed, 22 Mar 2023 13:56:26 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 443EE175AD; Wed, 22 Mar 2023 13:56:25 +0000 (UTC) From: David Howells To: Willem de Bruijn Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthew Wilcox , Jeff Layton , Linus Torvalds , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe Subject: [RFC PATCH 3/3] net: Declare MSG_SPLICE_PAGES internal sendmsg() flag Date: Wed, 22 Mar 2023 13:56:12 +0000 Message-Id: <20230322135612.3265850-4-dhowells@redhat.com> In-Reply-To: <20230322135612.3265850-1-dhowells@redhat.com> References: <6419bda5a2b4d_59e87208ca@willemb.c.googlers.com.notmuch> <20230322135612.3265850-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Declare MSG_SPLICE_PAGES, an internal sendmsg() flag, that hints to a network protocol that it should splice pages from the source iterator rather than copying the data if it can. This is set in msg->msg_kflags, not msg->msg_flags, thereby isolating it from the UAPI. This is intended as a replacement for the ->sendpage() op, allowing a way to splice in several multipage folios in one go. Signed-off-by: David Howells cc: Willem de Bruijn cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- include/linux/socket.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/socket.h b/include/linux/socket.h index 13c3a237b9c9..229f54484d3c 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -72,6 +72,7 @@ struct msghdr { bool msg_control_is_user : 1; bool msg_get_inq : 1;/* return INQ after receive */ unsigned int msg_flags; /* flags on received message */ + unsigned int msg_kflags; /* Kernel internal flags */ __kernel_size_t msg_controllen; /* ancillary data buffer length */ struct kiocb *msg_iocb; /* ptr to iocb for async requests */ struct ubuf_info *msg_ubuf; @@ -337,6 +338,8 @@ struct ucred { #define MSG_CMSG_COMPAT 0 /* We never have 32 bit fixups */ #endif +/* Flags for msghdr::msg_kflags (all internal to the kernel) */ +#define MSG_SPLICE_PAGES 0x00000001 /* Splice the pages from the iterator in sendmsg() */ /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ #define SOL_IP 0