From patchwork Sat Jun 3 20:49:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 102909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1841046vqr; Sat, 3 Jun 2023 13:56:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5y3fIcTVbjWpCAgFT8h9bCUHGKhAxaNazZPTU9o/ffScX4BtpKQGf5JSxtPilQsUWNYknN X-Received: by 2002:a54:4593:0:b0:398:1186:88ba with SMTP id z19-20020a544593000000b00398118688bamr4039267oib.31.1685825780549; Sat, 03 Jun 2023 13:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685825780; cv=none; d=google.com; s=arc-20160816; b=YTe/BIR4Q8m9iINK2hZMvmTm9LNP+0HGI2nnoMNyORH2EmnFo3O6r4EaWj1AWz7V8h O+zDYtQhVgtQY3XCqh+X+UYvv7M8Th2pgjTln/qkCCG6fSihuyzgiQJLAPHOm/XboS6n H/RVkVxKLWQQygn7k+rgjIj2rzEoe1fKi1Xz50JgXX44nSgCq6CLh5SHmp+obP98M/QH zbpGTvfqX1NZOyrxuvVUv3srPP+euMtwxCvwiKR+lNs9zsnHLS/E2afIDQrhs7hNkroC S+Hd6CRNwG5jrkbf8zWTqsvoMk+xx9eLfwowqgdbOI2U9do0Umb71nkfRn+FXEpzQHU/ SJXQ== 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=qcm1rcspds6nBbsYu4uQ/1LCrKuUtxLK5dK/r7j7bP0=; b=xSeo/lLm1aMt/6C7PeftvWEOrLbej0MSs/SZiU7AQfMyZ8JwDKRHcb7UhCdCG8PMM2 m+D5SzXCDCip8KyTnCND38HF9aMQLnHjX4STILUzJviIt11uGgJl0fQFSjmVLrLV1YLi +8gXFgCBPZ9leBabxdzU2bcMRW8MejuHjpV3PQgqIFrcybwRSB9mm9WBClARFFJP6pj3 QziWjxTG5V0U7VeOoUIBOrwf16oiS4LNcvNAeSqU4XqjadKiJdN0kbV/0rRFCBf09hcM au51tGewJBhhFBn6UHpv6GRELfYaGICYO73G30A5lZt+TAtLVT8TrKxG0c8YGAllIcTV eeaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=MmPb3KmO; 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 p5-20020a170902bd0500b001b0191881efsi3048578pls.37.2023.06.03.13.56.08; Sat, 03 Jun 2023 13:56:20 -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=MmPb3KmO; 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 S230241AbjFCUzU (ORCPT + 99 others); Sat, 3 Jun 2023 16:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232349AbjFCUy7 (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 0F4EF1AD; 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 A6D9E5FD3A; 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=qcm1rcspds6nBbsYu4uQ/1LCrKuUtxLK5dK/r7j7bP0=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MmPb3KmOmDkAlNV7uQJUepnw9OHA0sbu+V9hSOt+o4uHHfRcTfkwCL7vVQHZecjf/ fz4LQ8/VsoT0rdtI7SQum1P2MpWfHGUIAVWncb8bZby02vbsO1G9+zBENFl0JTBlYC 2WRYJv0kDv7YSMr0DckwdUsXcRxBwaQSd0QhSLunG+Biu7ZzUo+gB3b8vk48YZtYPO 9j/RRyXAQxjLWQX+mJzGLhIoirDYwjUkY+qlVUH5odDLCfzASh5uzu+PxKjwLMK8Oh 3qcxsIwMIJS4sys8u6XnRtPn/1pAbAoMyRw5UIGYt7Dq15fT1T74dO5xp3omLGQaV0 Tmg/WZa4gz+wQ== 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 10/17] vhost/vsock: support MSG_ZEROCOPY for transport Date: Sat, 3 Jun 2023 23:49:32 +0300 Message-ID: <20230603204939.1598818-11-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?1767716453543612453?= X-GMAIL-MSGID: =?utf-8?q?1767716453543612453?= Add 'msgzerocopy_allow()' callback for vhost transport. Signed-off-by: Arseniy Krasnov --- drivers/vhost/vsock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index b254aa4b756a..318866713ef7 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -396,6 +396,11 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock) return val < vq->num; } +static bool vhost_transport_msgzerocopy_allow(void) +{ + return true; +} + static bool vhost_transport_seqpacket_allow(u32 remote_cid); static struct virtio_transport vhost_transport = { @@ -442,6 +447,7 @@ static struct virtio_transport vhost_transport = { .notify_buffer_size = virtio_transport_notify_buffer_size, .read_skb = virtio_transport_read_skb, + .msgzerocopy_allow = vhost_transport_msgzerocopy_allow, }, .send_pkt = vhost_transport_send_pkt,