From patchwork Mon May 22 07:39:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 97152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1273301vqo; Mon, 22 May 2023 00:47:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fusXLhM4HPJbWhXiKlkeAmfoz5vbqjqq91hSyY7RO4X1Z+lWE+iLK+lv+AdqZo+pLbPT/ X-Received: by 2002:a17:90b:1a8e:b0:250:a4f5:fb34 with SMTP id ng14-20020a17090b1a8e00b00250a4f5fb34mr9714865pjb.2.1684741634555; Mon, 22 May 2023 00:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684741634; cv=none; d=google.com; s=arc-20160816; b=DeqmffsYZvKOVljpkdsD3l1LmEVzTqUysH6s3PGHpw9Oq8ag0J/Hb4mChKUMw24Cbm V/v5BNDxhs9q8mquhy/TanO7knyzR04jlZBaT5H7kicFZILP/A7hpqxvUoZHvVUqrph5 yYGrjC8PayUfcMVZX0OBeyUB09Mg3U9Ix5L3gZ41iPoR55rOEToM13gf0lMwM2/6sNYl JDw8r1Nqd/ajBsiDPjmNzgd0Y6ypKqRJ6YOqo4ZqB2zhHJPsB1Lorj5udMrsOiK/2XkW 5GulXbP5WYqSbxwe10KMuueWc+/dQui7W8V7McaJx3aLUBJp6ZbxH6LscJtldsf7m7Hi T5Cw== 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=3BbsJ5TMl3aSTqlIon+Jbfxl/Far1E+D+4rr7uYhsuk=; b=PlVd18Lp7UAxy+k2DnCms26mnZ33epnCixMM06SnRIDK2YrJMr1vSkZ8L8SUUEeM4T jxbe4CeAyBHNSSlT+l56p17ioDEFFONirk36wjp+JllyNuCwHCGmsYd1Rx3q8wsOMaiQ oeaagYF6sn0Mm7TKAOANrs6MpHX4pdN67cPPnKu4LGvlvffB4nEuE6lhYfHGwyiiGoiv F+4dPmVBvN7sQOqGgdNXn+RN+K2DCP5QJR6NeOr+gEX/OGMcT1yLSiwj7+IYBbvQkaac ZfFzijiAEOH7KInKuQr++ZmoZhXwIvF00diyixF7OoxD8PLAKig/yiWiUUaHuX+IyjDZ G6OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=lqvw15LP; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a637203000000b0051b2e37e657si866506pgc.719.2023.05.22.00.47.01; Mon, 22 May 2023 00:47:14 -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=@sberdevices.ru header.s=mail header.b=lqvw15LP; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbjEVHpU (ORCPT + 99 others); Mon, 22 May 2023 03:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232673AbjEVHoy (ORCPT ); Mon, 22 May 2023 03:44:54 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A3FB6; Mon, 22 May 2023 00:44:53 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id B9F285FD53; Mon, 22 May 2023 10:44:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1684741490; bh=3BbsJ5TMl3aSTqlIon+Jbfxl/Far1E+D+4rr7uYhsuk=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lqvw15LPfzEaL1BzK8IGJMhXFr9hkMGIayN80/EgUyWFuk3qlrbqoJtl3/bTZbRQK 2oezNG9icLHyj8AStDPNHg8/7QYSSqPNSPHyr8v94a2PPyMMtoXvPmPj0ipteWTsp7 kNwSSlRRaDdbG2XRF3s5LuNfW4IzUPPJS7mO/ET4SBmtcCfZGCe6IcNfao8QQe1eaO vuDNoPW3s8tHu6COqxKrt8E2tmSIRjenc3OsaIGXelOWoeaFpk8BAFbe4jNX0O8yFs sf+owYZMFcbXUBKWH+D40MLQ2eoTKWhwrG6Cf4hu+YYi9j32CfSvsSiknxvK+R6Ehw iG13+N51T8i1w== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Mon, 22 May 2023 10:44:50 +0300 (MSK) 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: , , , , , , , Arseniy Krasnov Subject: [RFC PATCH v3 09/17] vsock: enable SOCK_SUPPORT_ZC bit Date: Mon, 22 May 2023 10:39:42 +0300 Message-ID: <20230522073950.3574171-10-AVKrasnov@sberdevices.ru> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20230522073950.3574171-1-AVKrasnov@sberdevices.ru> References: <20230522073950.3574171-1-AVKrasnov@sberdevices.ru> MIME-Version: 1.0 X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/05/22 04:49:00 #21364689 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766579643712565228?= X-GMAIL-MSGID: =?utf-8?q?1766579643712565228?= This bit is used by io_uring in case of zerocopy tx mode. io_uring code checks, that socket has this feature. This patch sets it in two places: 1) For socket in 'connect()' call. 2) For new socket which is returned by 'accept()' call. Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/af_vsock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index dbfe82ee7769..bee1c36dc29f 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1406,6 +1406,9 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr, goto out; } + if (vsock_msgzerocopy_allow(transport)) + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); + err = vsock_auto_bind(vsk); if (err) goto out; @@ -1560,6 +1563,9 @@ static int vsock_accept(struct socket *sock, struct socket *newsock, int flags, } else { newsock->state = SS_CONNECTED; sock_graft(connected, newsock); + if (vsock_msgzerocopy_allow(vconnected->transport)) + set_bit(SOCK_SUPPORT_ZC, + &connected->sk_socket->flags); } release_sock(connected);