Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2586293rwd; Mon, 22 May 2023 00:47:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5LdWOHnDuQmFum6ylhVHvc8qJWKEwOSGBOuJ7a+TJDelnuEbtJyjio7VSa6aMo6QmTSh54 X-Received: by 2002:a17:90b:1bc7:b0:253:828a:28f8 with SMTP id oa7-20020a17090b1bc700b00253828a28f8mr9514442pjb.25.1684741656044; Mon, 22 May 2023 00:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684741656; cv=none; d=google.com; s=arc-20160816; b=Jw2DTbLrMCFS0gJAcMczAsAeMXqdv54j8+VXNrujgZ57fVH2G/MBz31iQ04WPHWG4n LgOBGEDm97c8be9V2AR7B2U2SY+RNbsTTVkEgaJForlzjHEVeaLa0f5/z87EP1l3Gipa B1ad/5SKecvtStiWeeXcD4/0LcglsmZHTdfGnN7S0nuse3VsWXrcX2ydWu4g3pitG39k MQ2pg9wJJ3oZDBG1SaYxc3t8Y5D7dI7xRtoa1uTSF+hT5tJk22OOpEhzpMvjuu646J8e itv7mTIQ4AzxTQzoyykp2FL6xUiIfQdMwKIVwoWV+8pBvWiRgJlDHrpkLRs9A7eGC96N /caw== 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=Lcii1bQY+QJwpWB+RMSKu82Ek54JP6VHZpwuHhErzzg=; b=Tmx+acdUmWFR89zVjR9GGl5IWYWhTORGdrZMuI5kTfSOkm9qRXOORW6w/hmRO260UW 3E9oW73rNXQhCbmJ0JWnm5j/DmcxB/lN9S6hEsDxzOqHt2iRip18hPFkhOm8FXA1Qi0r nVhXHRJGKf4UnWdhgs+o6+SAy4NF+zOtPbNn8L+Vt/9IJG85Al+JIWavMumwwnuMnQ2H Ng8HUMy3eqJz1GDbhj0FpHkLWPhxrwWFM1v/WZpri/ODw5ON6ZwWreGOVC8qMuof/W4l Hf1gsRvCXSI5/ogf8KzUw+ehhV/C3d+e8YoIZbzWuSoiePplqzl+YfGg2XHgPYvZPQZR XN6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=i4G+Rrrt; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv7-20020a17090b11c700b00247b1a05438si4098118pjb.16.2023.05.22.00.47.24; Mon, 22 May 2023 00:47:36 -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=i4G+Rrrt; 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 S232126AbjEVHqF (ORCPT + 99 others); Mon, 22 May 2023 03:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232564AbjEVHo6 (ORCPT ); Mon, 22 May 2023 03:44:58 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 060F2B0; Mon, 22 May 2023 00:44:58 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id AD5295FD57; Mon, 22 May 2023 10:44:55 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1684741495; bh=Lcii1bQY+QJwpWB+RMSKu82Ek54JP6VHZpwuHhErzzg=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=i4G+Rrrt8FjyGOQCUGkcbP/uLAllSTwiqRcxvCBd+AEUplaO/lK78vVC+rYo2n2dg 6CrJTQTnWmiBC2R5qp9XHHLBF+66RXNEtTJ+WpChSoU8ZgqL16OD0QCWv6ZKlxIePt moh9Dglj70wLhzMyeUKIhY1loWO0U2fhzJBFjkP4JhMl3rPqMuXJJS37WPyYlE1EzK P+RcV8M9PyZaFgqhMPwV2PQFBOI6tThFm819ly79cLBn3kQ6SsVUcoUqMihPtCR1V3 2v6/YdVS+bStijZuOPRP3+7zzCtyMNO1WtUH/5LdZdn9BZIYJnooy1wtYip/wJRbr1 dRbf559Dj2Qbw== 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:55 +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 13/17] net/sock: enable setting SO_ZEROCOPY for PF_VSOCK Date: Mon, 22 May 2023 10:39:46 +0300 Message-ID: <20230522073950.3574171-14-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 PF_VSOCK supports MSG_ZEROCOPY transmission, so SO_ZEROCOPY could be enabled. PF_VSOCK implementation is a little bit special comparing to PF_INET - MSG_ZEROCOPY support depends on transport layer of PF_VSOCK, but here we can't "ask" its transport, so setting of this option is always allowed, but if some transport doesn't support zerocopy tx, send callback of PF_VSOCK will return -EOPNOTSUPP. Signed-off-by: Arseniy Krasnov --- net/core/sock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 5440e67bcfe3..d558e541e6d7 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1452,9 +1452,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; -- 2.25.1