Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4756479rwr; Sun, 23 Apr 2023 12:32:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Yh6k/W3e4NGrMzAkgUSc2Gz7idwz+XOoaQOTAgHQQDbbVlQg8GwDzRjd1v9yDipzdwkKyu X-Received: by 2002:a05:6a21:1195:b0:f0:5f9a:f5d5 with SMTP id oj21-20020a056a21119500b000f05f9af5d5mr12600406pzb.41.1682278358301; Sun, 23 Apr 2023 12:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682278358; cv=none; d=google.com; s=arc-20160816; b=FFV1sMNknFCVAU5k7tO0CSvwYwbt4Wy9nz3yHZu0m4PCXw/AUGxrqbXVhA25FNZNBy 1tOrJSXLJLlnaY1Hf4gxNPADu2/7pVT+fX8d6fRQYStCAm6K+MWLYdx1BaC7vBmbhW6i mngPXHFSXFyeDWi2M2oC+szuWPNFzq3kl6J5so/3WP1MdEpYbxgGDY5uCfsYFErtxCF0 Yv6TbfHDfjrH2Wriq1vrHVeuepuSBFG0k1YPDEgN3NBEO7FEofcJBtzGjjmUB19uuMfn llPTOvNS9VUlEo1VC5BPv0dmvRw5nuvcNVXy5N9BOg3liGCjLwbQ7BTKGC4Z+gqdf8WW AKaQ== 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=8MkOLhUem8zje6YCZe3k8/M7+vTx+mrb7f0DcsdGdpY=; b=GNBs7uJrDmS6Mx5FBvSrPZYkzM36Ulao7h1JU9Rajbryg1SbDXE3um7giWwprB+DZm 2qdkhSa9I1ks3sVeBd27U763wtl4AIWakr5kr256vzUsvzPK/rVyr00UYl6FmxRqLafa VD28QKQZs1ly9ZhIveMfv9pcglsyYVSQYFvkYyhJceMphW83IxiXm9NOohw0oknd4U+n 5DRegeLDUmrJfdDAIynPSTMM41pH2D4KwK0EyJRakTTcCnnXBTkTigHiD/qksSZto8sj pWMrQh5pOGEoxpjtT3KJH9cf+X2ExbgVcelzcFPsq1ovVdROELi2u9TyVn60nZNqkdNo ZkIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=KoO6dzXS; 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 h70-20020a638349000000b005254580c66bsi2358013pge.231.2023.04.23.12.32.24; Sun, 23 Apr 2023 12:32:38 -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=KoO6dzXS; 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 S230317AbjDWTbw (ORCPT + 99 others); Sun, 23 Apr 2023 15:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbjDWTb2 (ORCPT ); Sun, 23 Apr 2023 15:31:28 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54FDFE52; Sun, 23 Apr 2023 12:31:27 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 4CF2A5FD13; Sun, 23 Apr 2023 22:31:22 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1682278282; bh=8MkOLhUem8zje6YCZe3k8/M7+vTx+mrb7f0DcsdGdpY=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=KoO6dzXSzca3ttXVlKbvpwC3NwC5pb5eblm52zMokNdxh1SlYEEMB5LTkTdBoPwhd LKrrWG1ggHFLSx28sULqj7Fv7R2u36fHrcRfT7KWZXODEV/uujk9ikrmVrobYOZy/X h3KvORYZ3TyrHc9hiM1Klf/YJNRJq50O2R7uLL9t+k8uINNLiPz+6fUkRpwWUZ31fn m7TIlwljA/lnsHZaVQ3CgPLktq1gunvZJE+0SxvPQbHAso7iNSfkD2cmvRZniGyRbm AZKz3FwsuMvL+kmXyIdYB/LVJMqm9S2ltOGpSki/TL9iqwRbFHwO2T/6bRHqvczvGd AgBDybI60Gzfg== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Sun, 23 Apr 2023 22:31:22 +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 v2 08/15] vsock: check for MSG_ZEROCOPY support Date: Sun, 23 Apr 2023 22:26:36 +0300 Message-ID: <20230423192643.1537470-9-AVKrasnov@sberdevices.ru> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20230423192643.1537470-1-AVKrasnov@sberdevices.ru> References: <20230423192643.1537470-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-EXCH01.sberdevices.ru (172.16.1.4) 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/04/23 16:01:00 #21150277 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 This feature totally depends on transport, so if transport doesn't support it, return error. Signed-off-by: Arseniy Krasnov --- include/net/af_vsock.h | 3 +++ net/vmw_vsock/af_vsock.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 0e7504a42925..270ca54cfab8 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -177,6 +177,9 @@ struct vsock_transport { /* Read a single skb */ int (*read_skb)(struct vsock_sock *, skb_read_actor_t); + + /* Zero-copy. */ + bool (*msgzerocopy_allow)(void); }; /**** CORE ****/ diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index c50d2632a75f..eac8c1affd6a 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1824,6 +1824,13 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg, goto out; } + if (msg->msg_flags & MSG_ZEROCOPY && + (!transport->msgzerocopy_allow || + !transport->msgzerocopy_allow())) { + err = -EOPNOTSUPP; + goto out; + } + /* Wait for room in the produce queue to enqueue our user's data. */ timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); -- 2.25.1