Message ID | 20230423192643.1537470-9-AVKrasnov@sberdevices.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2339211vqo; Sun, 23 Apr 2023 12:38:15 -0700 (PDT) X-Google-Smtp-Source: AKy350bxuJroyvL6AGMCQENObvE/S7K/KCydxxTrG+R5H5PixY69HNefonLhGA4NPxJLZ69Kz8l3 X-Received: by 2002:a17:903:2287:b0:1a3:cd4c:8d08 with SMTP id b7-20020a170903228700b001a3cd4c8d08mr14047970plh.38.1682278695655; Sun, 23 Apr 2023 12:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682278695; cv=none; d=google.com; s=arc-20160816; b=fwT5KzSdG6deXLro1DOxT2h2iMCGaA8lbPVwNl7TPlGmTPmhkT76fHaY+s0WxTuGhB ECQpcYbDBdrUUvXTqaCc8vU9Qr8Z4Meq+VaH7eDBC9RZ1PHARHWtR5GPJ/NnqGtNakRM vZFWS0vJce3FSfcYOVIBFibs5OuQXblXbOXFhb5ClqFvh/rUgjFndMUVbHcXOm4rSdQw PPY37MHcw+dmWEiBx2U9nvtN0epQT6Lwcs9g1USw1DpvU3kISbRM0cD8dmCsoCBU8gId GRSLwjIIYGCaSmS3vmttW0T+ikVY9JBfvqpr5wnTAeHTNy/jqoFaCrhaP4/liB6mhZgE yqUQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a170902e94700b001a66ff9542fsi10327537pll.616.2023.04.23.12.38.00; Sun, 23 Apr 2023 12:38:15 -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 S230319AbjDWTbx (ORCPT <rfc822;fengqi706@gmail.com> + 99 others); Sun, 23 Apr 2023 15:31:53 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <AVKrasnov@sberdevices.ru> To: Stefan Hajnoczi <stefanha@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Bobby Eshleman <bobby.eshleman@bytedance.com> CC: <kvm@vger.kernel.org>, <virtualization@lists.linux-foundation.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <kernel@sberdevices.ru>, <oxffffaa@gmail.com>, <avkrasnov@sberdevices.ru>, Arseniy Krasnov <AVKrasnov@sberdevices.ru> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763997065422879119?= X-GMAIL-MSGID: =?utf-8?q?1763997065422879119?= |
Series |
vsock: MSG_ZEROCOPY flag support
|
|
Commit Message
Arseniy Krasnov
April 23, 2023, 7:26 p.m. UTC
This feature totally depends on transport, so if transport doesn't
support it, return error.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
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);