From patchwork Mon Feb 6 07:03:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 53033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2091629wrn; Sun, 5 Feb 2023 23:07:09 -0800 (PST) X-Google-Smtp-Source: AK7set/CnrKUFxVfVbS/ahVgUI4EiUY5+w+emdfRyHK06TnYLCD6Pu3T0kYZuJxTswvQ2Uv4oCac X-Received: by 2002:a17:906:184a:b0:878:74a9:1869 with SMTP id w10-20020a170906184a00b0087874a91869mr20513025eje.3.1675667228893; Sun, 05 Feb 2023 23:07:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675667228; cv=none; d=google.com; s=arc-20160816; b=XPhPrnEZyjUDDW/2wOHPa6s9e+K0Rpb0SyhIvB4wNRhr4yRVyirYa65v+HhFP6sGx1 eipM6fPr1PvxS7Nx+ESi9iC/qgacXYLO2t4jXBur/8crZgZqJUTT1X7ZwkwKD7o7PFLM U7nlLCQkxrk+4JehGYznuOHS1h+rCbOvHzhFztQZJmLkrWfIAQ5GIOEs2QJ/Sc3Lb4dN MvmtJxcvR2h2CDLspdSA5OStfHtqqxBnLEYJR1m0tS8xE511HmSEgrOCfJjnrZz+rfvZ OqtqYV1cU2EicPHXIjnNb+jnp2YLPuBrne8mhcSDt34j366SIQs7erq2ZuZunCvTAHjX hrIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=B+7PRVOOaI2lvcTHzeaPsvVUOzr1Zjh3HhP1m2qoBFo=; b=xBaoEs8R0gaj/a6/RjBwB/enGmoMou6CLBaC4CREYmg+0OhRpjZthlzXwavXXbPUHx sQ3ruBdGrC5WrBSElnLEtz6UXD1KE+QoADW+sxT4+oHsDpWFI5mVgpoTyq3bIcXvcH6h dVrHwmV7D889z+AUOVL8W49wcYw0mZMtag44BQA01x82q6fvEBpQheUlfhBaYAQ4LqYy y7x8cun+we7M48VXUGoE3P3jIEwapVUox6M4B3Bv/RE7HTLqIRIB8ShjkyhJaKWuQDNY glls8yjtq4YSINvdhifrVehesmqXH3Zk4iwY3Fe94u44pfqSKZjIxFcDXt6bICQT47uL +kUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=l4uIPL1D; 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 u5-20020a170906108500b0088560b779a4si13820852eju.733.2023.02.05.23.06.45; Sun, 05 Feb 2023 23:07:08 -0800 (PST) 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=l4uIPL1D; 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 S229878AbjBFHDi (ORCPT + 99 others); Mon, 6 Feb 2023 02:03:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjBFHDh (ORCPT ); Mon, 6 Feb 2023 02:03:37 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E18FA6EAB; Sun, 5 Feb 2023 23:03:35 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 4C3175FD03; Mon, 6 Feb 2023 10:03:34 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1675667014; bh=B+7PRVOOaI2lvcTHzeaPsvVUOzr1Zjh3HhP1m2qoBFo=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=l4uIPL1D9fJB9FFBwrk1cI7jtL23oGVWWZooJQ1YQ4irLYuQtpGJBAjh/4NGrEQZf ewRwJZTqzIyslWE/AZ8nvxzyXe+Z39p2cFOp5lLQac0IyVlDskHY4A/sZ51465bgxz uzriKAYIyOaixZxClp+/G/tDAwsk5mgU+OJlrzqssvopbJO1ai8s5kmpRBiIFn40sB YOfJaTSjDQ6XBnqf2hcnExUD89blFvCvGZy9FIVo+llsC2QHQYP8NRLFXyzimWw//Y CZF6R6Xl8O7hF7n58x4McXuDa8JDslAAKgEAcztPuTkr+C7aZZQcumvtpblpONTLxW e/SfuHiuAXTtw== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Mon, 6 Feb 2023 10:03:34 +0300 (MSK) From: Arseniy Krasnov To: Stefan Hajnoczi , Stefano Garzarella , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Arseniy Krasnov , "Krasnov Arseniy" CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , kernel Subject: [RFC PATCH v1 10/12] net/sock: enable setting SO_ZEROCOPY for PF_VSOCK Thread-Topic: [RFC PATCH v1 10/12] net/sock: enable setting SO_ZEROCOPY for PF_VSOCK Thread-Index: AQHZOfkgd8nezKwWuky7m6WWWc9yqw== Date: Mon, 6 Feb 2023 07:03:33 +0000 Message-ID: <0ad20428-b93a-b1e5-ea10-60449d25e0b4@sberdevices.ru> In-Reply-To: <0e7c6fc4-b4a6-a27b-36e9-359597bba2b5@sberdevices.ru> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-ID: <6B6138F15C68B647A82F25C1F6E32944@sberdevices.ru> MIME-Version: 1.0 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/02/06 01:18:00 #20834045 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_PASS 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?1757064440396671470?= X-GMAIL-MSGID: =?utf-8?q?1757064440396671470?= PF_VSOCK supports MSG_ZEROCOPY transmission, so SO_ZEROCOPY could be enabled. Signed-off-by: Arseniy Krasnov --- net/core/sock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/net/core/sock.c b/net/core/sock.c index 7ba4891460ad..61f15de84e82 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1457,9 +1457,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname, (sk->sk_type == SOCK_DGRAM && sk->sk_protocol == IPPROTO_UDP))) ret = -EOPNOTSUPP; - } else if (sk->sk_family != PF_RDS) { + } else if (sk->sk_family != PF_RDS && + sk->sk_family != PF_VSOCK) { ret = -EOPNOTSUPP; } + if (!ret) { if (val < 0 || val > 1) ret = -EINVAL;