From patchwork Sat Jun 3 20:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 102917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1841685vqr; Sat, 3 Jun 2023 13:59:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fD14aMJdHG3ngDR89i2gpFAYU7N6KdQngk1nH5qRz4FKG1uTyW88g7h9c29bEx2O/60IL X-Received: by 2002:a5b:48e:0:b0:bac:faf2:328f with SMTP id n14-20020a5b048e000000b00bacfaf2328fmr8013379ybp.6.1685825970887; Sat, 03 Jun 2023 13:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685825970; cv=none; d=google.com; s=arc-20160816; b=ephK3D/eb3XjMOgtUfU3xgmlyC30vf8utN5xIHAnbzcIoA7DCnJQFxGKSJpS6OdpwN 2yg8V8UI/h7/CatArsbMDyVoJ2lu+88t0pReh+vDnwQCxpgCrTNoc37YjcXGg4az+QkH GDivvv/GMMplg+gRTzT8fQigDSYlrnVUBuTXL8smxWJED9Hz+yxV0mKQIJ7o9YgKJbka WiFNmi5R+yRL9oAUjhcn/d/IMpBIHLbwMFB66eo8kngUj9WaIEutWeadQ1qpChrI3slW Nr/8m5eztRzMPxgt8qTigeYn5+yatIb4imCxrwXgUYXYmI1uhwfa3fQnZR8OiIVNJAOR pNJQ== 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=HekjpGnl2zxNT3T4PtMzqPreuhYkvcvhGbre4mbN788=; b=xfH8bcFrsC3FcbNnFbuTyW19xxUJ90+UNZ7JU3UFDC3kRGleRmjetxuID2sdmz0Pt7 /up3Jh/5+jgOzDbfRXMYeyicqmaTT0F8+IIcxRYOcZ1SrOL5mvPFZNOBPUyTg+Fyyr+K KqkTGlm388SqZqlNBvYrqSgN+kHUEIdN95SsNaRAVw0bIeFToMvmmTWJ/rpCyAO/yGz8 pw+7ErNr+2XyWfDsK5U71SZb5hHwabqnZawbMzTJFd8PfVXuR0Rwq5b6YrW7bVmvPzKl cfy2gmSTUXZs5rkpCxLLiQi+XU/ppNO7FlfmiDNtaR3sAdtOH0pV9Z6173MlRLchRqmh 9Zsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=DOftSGo5; 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 19-20020a631753000000b005346bd7dee9si3093727pgx.682.2023.06.03.13.59.17; Sat, 03 Jun 2023 13:59:30 -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=DOftSGo5; 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 S233669AbjFCUzz (ORCPT + 99 others); Sat, 3 Jun 2023 16:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232454AbjFCUy7 (ORCPT ); Sat, 3 Jun 2023 16:54:59 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0614F197; Sat, 3 Jun 2023 13:54:56 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 6924E5FD39; Sat, 3 Jun 2023 23:54:48 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1685825688; bh=HekjpGnl2zxNT3T4PtMzqPreuhYkvcvhGbre4mbN788=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DOftSGo5jo+m1kOZn1BX823Entw774YsTwmEx0s/oDAQnInujhEzATdLSri2+OWYa 437mQH8uge5FhXVuEjrmL9xzJINR9hE+wSYTkm8Go2L3tf9I/ZtqgsbRJiMFR/Bzh1 NZboWvgrY3W7o98G6QU7G7WFpM8jc9Z2ujC9WLSGWBeOEppHSsxBA+79ImUdNKQ8nG 0txlfzL06k/RoRXCiGw+xt3I+Bp+O5mfTBnzXlCGA8pIhx7jekcukLbkRJC1cOPhEW xE1xmwzhs1wdM6wvOzqcOMXatao06chVuQD2dzQhq9dtsw0UdPRpP5vMi+I+HqP8A2 pGbWf7fM5BHzw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Sat, 3 Jun 2023 23:54:48 +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 v4 09/17] vsock: enable SOCK_SUPPORT_ZC bit Date: Sat, 3 Jun 2023 23:49:31 +0300 Message-ID: <20230603204939.1598818-10-AVKrasnov@sberdevices.ru> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20230603204939.1598818-1-AVKrasnov@sberdevices.ru> References: <20230603204939.1598818-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/06/03 16:55:00 #21417531 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,URIBL_BLOCKED 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?1767716653281509887?= X-GMAIL-MSGID: =?utf-8?q?1767716653281509887?= 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 033006e1b5ad..da22ae0ef477 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);