From patchwork Mon May 22 07:39:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 97168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1275632vqo; Mon, 22 May 2023 00:53:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Kf2RhusDYLfgiQCFc/CJ24Oypq0F2/c0LvfTl5V9ZlHorAkqw5EKxhUYn0F/qUGHMxH+O X-Received: by 2002:a05:6a20:6a1e:b0:103:b448:ddd8 with SMTP id p30-20020a056a206a1e00b00103b448ddd8mr11901291pzk.58.1684742036221; Mon, 22 May 2023 00:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684742036; cv=none; d=google.com; s=arc-20160816; b=qbrEkQ/+8llkwtsGmSJNPesh/48/JRYaVm0hHxA/L9yUrgInvIhXW3V3Mm1HrJVE5R j/JON8w+DlgcXMVC19UIDNtVrPX3ZRkFmm2P28q3crBAtpezcQxyuf7ScuSR468KhbRZ XGrwR+d6D+KBN8GyIjvu31PFRYr/LNffdjAZK8hA3cu3Z333QRwRFxlENpuCXgjWaLx6 mTvz1X9OmIKff745N8o58FzhrC9A+b3r2OI948lKvU7EnMa6lgH3IxhcbMMvieZfMv9N 6pQNlljWRLYEX8zoC4kJEesTfP4RBaK5Fze4tpu20bL0e12Y3KuhFv9so7KPrB+tMd10 wJag== 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=g96X5UYRFcd04b1pfBa+3+4h3v2dzMPlcj5zfmu6aFhRTo67rRqBKO5ouoHPC+y4EQ TDrKMGqYxEbRyZeuxYyqknTpAPZ7qwQFQdwAEFbwg8sl69nWBNOtaqr3NUDHx93fHZbr D7kLTw5NA0HxSiMTInVasKDf4G53afkpcD4df+n4Y5fWpy7xW+B1r+BphVko/mp6BaAh HSwb5i8ageXDrfi52sWWIa5qfU/S+aMrv8HVJhOhuaymbU4eNA/aO8ehkFfq6SFvYlCN 9v9al8swiJ0pZB+i3g3qmyvqCGfK/nko+MO6Ut3VL1JGu4PVx0x0bKkiDI3D2ixEd4be ps7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=hNi+O0Yp; 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 e8-20020a17090a77c800b0024e562f9f73si4261839pjs.147.2023.05.22.00.53.44; Mon, 22 May 2023 00:53:56 -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=hNi+O0Yp; 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 S232311AbjEVHo7 (ORCPT + 99 others); Mon, 22 May 2023 03:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbjEVHo4 (ORCPT ); Mon, 22 May 2023 03:44:56 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A1E6AC; Mon, 22 May 2023 00:44:55 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 710585FD54; Mon, 22 May 2023 10:44:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1684741491; bh=qcm1rcspds6nBbsYu4uQ/1LCrKuUtxLK5dK/r7j7bP0=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=hNi+O0YpqXs+X+aAEOSxILxwbo20X1nPmnjySCh14oMTUDskE7sEmWLTIpzG7OnGD Q/NLNSehgteTrylb4hZb8gwDF2RwFR8aW3dhkYTcUWHcdiD55WGcPUTOJi0qeiLTfK brvTnlG7qfwQGdZyqDPn3uY/uTNQO0XlY7Owj06EK7kT4eyPv0zr/dwPns7Hl6dZMR yYHyq7eNDc3cTaWPRZpIq3plZtJMzi86RU5Fy8LxmnU6DDR/+YmZpj0lH1RaY+Timc Tsr820Z+37jj3MiCjtgsVPAMprF+EUUZgV5PpAAlT8NBK/ud6DNUCluV+9goe+9Uoo 1509GwAtG4jSQ== 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:51 +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 10/17] vhost/vsock: support MSG_ZEROCOPY for transport Date: Mon, 22 May 2023 10:39:43 +0300 Message-ID: <20230522073950.3574171-11-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766580065208732747?= X-GMAIL-MSGID: =?utf-8?q?1766580065208732747?= 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,