Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1073552rdb; Sat, 7 Oct 2023 10:30:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcgMuJdSQE3QcRgs+ThClUiIBcwK6M02Cq0SxhfoLsu4DNDxAJ1Z1IsUBvf+kvAqT9TaQt X-Received: by 2002:a05:6a21:3296:b0:140:d536:d428 with SMTP id yt22-20020a056a21329600b00140d536d428mr13179854pzb.51.1696699857534; Sat, 07 Oct 2023 10:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696699857; cv=none; d=google.com; s=arc-20160816; b=O2Ne55wZhy4OufFauyrjLcu8/Ec/bXpT508QpkB/M6ZvRVHPnlK0gtG5WeOZxMaPSK wf2RocmG0pJhek2uYrGoh3q8YpgMZKxRH21pqF/QNebH82fnDnCU32RsMDTRv9zrgwAq LBy4Wkp33lr0KhQkMhS2q8y3eE1uRJkSIphYALU+JmkWdf+Ty5y6xnEgYGNCAaCuIQvq kx4JatslR8svlWcZLdYQesKJfO0CjkQSz+d78G46T1pDQ/Fm5zrDIGPFNtCzGbh8MBm5 IQ2klBfanN8JQIYDrp16+M9Eq7mPsil3mrkhdwXLtXl+htnrUWP7AKqizhGjKDrPIZFE J0jw== 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:dkim-filter; bh=2q6PSRggf6vem+NLKmcewZXqkO+52GMU/I8fUbkPVOA=; fh=wIHqZpOIuzcidDZ82yQbOZuyHJty7uvaWDEh/efoVzA=; b=BZ8bpHkbQHJ7QGbzfXODW4Xlm952BIhQy9dLSfofs0nJDbts072VlBrA+JGOgEXZtL V81ih9TgDQlQe7qpnyq7CAFqSqG3F2eOQaoJRt2VMb3g0/Kh4BRU/oZnM8QcTEJk5xSX kowA2+EfpfOO6/SYjgF7nQzi/7P6e4rvOhQYFNbrlgq73ZgRDKVfVA6EwgPzdcigycew rsE2V/x2lLBmaFScoot/zCMAjyQVg8fIhMdWB2BV8wMWv3nqFwwoqGv9d4AMy6r8vopR LnQS6PMhxcYak5PDkmuNzTPizqmMA3WArjkVul731DgnMhVJjpi+bieWj+9EAdeDeWwi o0Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=i4d4JQgZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id la16-20020a170902fa1000b001bbcddc33dasi5869194plb.180.2023.10.07.10.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 10:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=i4d4JQgZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 33E3A80947E0; Sat, 7 Oct 2023 10:30:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344216AbjJGR3P (ORCPT + 99 others); Sat, 7 Oct 2023 13:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344126AbjJGR2x (ORCPT ); Sat, 7 Oct 2023 13:28:53 -0400 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B07BA; Sat, 7 Oct 2023 10:28:52 -0700 (PDT) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 72A9712000E; Sat, 7 Oct 2023 20:28:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 72A9712000E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1696699728; bh=2q6PSRggf6vem+NLKmcewZXqkO+52GMU/I8fUbkPVOA=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=i4d4JQgZe/eVrI4lMMA3PmwoZaZamTJj5HmzOuCk6WDHMWy6V5saLXLxgmkxxP3sn vAJ2lAVMO8LiJDvEnQRc9Ahy3gJyrYcB9etQk3IyecDkPbegvTlkuV2TwbNKKm11Fi m12suLUYeOlNkLZGB/mFOt2D2ETx2t4lS7dUD8CqHtWOaytTyaMb6WP3OWj5q4GMwy z5SZ+ifJsyBp3LWZptrvbM00AYwmw9O4PAvmxpyGPr9KZ+if89pOIaZ1gdLqiyns/H 8BQUJ0qW46Lr+vkLVXP09ANZ7U1g3oH7PT/wjzSVZGJ500qXZSqIBivx/zL1IbZiOi gAFeTEcMdOHEw== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Sat, 7 Oct 2023 20:28:48 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Sat, 7 Oct 2023 20:28:47 +0300 From: Arseniy Krasnov To: Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Jason Wang , Bobby Eshleman CC: , , , , , , Subject: [PATCH net-next v3 09/12] docs: net: description of MSG_ZEROCOPY for AF_VSOCK Date: Sat, 7 Oct 2023 20:21:36 +0300 Message-ID: <20231007172139.1338644-10-avkrasnov@salutedevices.com> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20231007172139.1338644-1-avkrasnov@salutedevices.com> References: <20231007172139.1338644-1-avkrasnov@salutedevices.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 180453 [Oct 07 2023] X-KSMG-AntiSpam-Version: 6.0.0.2 X-KSMG-AntiSpam-Envelope-From: avkrasnov@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 535 535 da804c0ea8918f802fc60e7a20ba49783d957ba2, {Tracking_from_domain_doesnt_match_to}, salutedevices.com:7.1.1;100.64.160.123:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/10/07 16:48:00 #22085983 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 07 Oct 2023 10:30:28 -0700 (PDT) X-Spam-Level: ** This adds description of MSG_ZEROCOPY flag support for AF_VSOCK type of socket. Signed-off-by: Arseniy Krasnov Reviewed-by: Stefano Garzarella --- Documentation/networking/msg_zerocopy.rst | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/msg_zerocopy.rst b/Documentation/networking/msg_zerocopy.rst index b3ea96af9b49..78fb70e748b7 100644 --- a/Documentation/networking/msg_zerocopy.rst +++ b/Documentation/networking/msg_zerocopy.rst @@ -7,7 +7,8 @@ Intro ===== The MSG_ZEROCOPY flag enables copy avoidance for socket send calls. -The feature is currently implemented for TCP and UDP sockets. +The feature is currently implemented for TCP, UDP and VSOCK (with +virtio transport) sockets. Opportunity and Caveats @@ -174,7 +175,9 @@ read_notification() call in the previous snippet. A notification is encoded in the standard error format, sock_extended_err. The level and type fields in the control data are protocol family -specific, IP_RECVERR or IPV6_RECVERR. +specific, IP_RECVERR or IPV6_RECVERR (for TCP or UDP socket). +For VSOCK socket, cmsg_level will be SOL_VSOCK and cmsg_type will be +VSOCK_RECVERR. Error origin is the new type SO_EE_ORIGIN_ZEROCOPY. ee_errno is zero, as explained before, to avoid blocking read and write system calls on @@ -235,12 +238,15 @@ Implementation Loopback -------- +For TCP and UDP: Data sent to local sockets can be queued indefinitely if the receive process does not read its socket. Unbound notification latency is not acceptable. For this reason all packets generated with MSG_ZEROCOPY that are looped to a local socket will incur a deferred copy. This includes looping onto packet sockets (e.g., tcpdump) and tun devices. +For VSOCK: +Data path sent to local sockets is the same as for non-local sockets. Testing ======= @@ -254,3 +260,6 @@ instance when run with msg_zerocopy.sh between a veth pair across namespaces, the test will not show any improvement. For testing, the loopback restriction can be temporarily relaxed by making skb_orphan_frags_rx identical to skb_orphan_frags. + +For VSOCK type of socket example can be found in +tools/testing/vsock/vsock_test_zerocopy.c. -- 2.25.1