From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.5 Received: by atuin.qyliss.net (Postfix, from userid 496) id 20DE83609; Thu, 13 May 2021 00:50:44 +0000 (UTC) Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 54A823513; Thu, 13 May 2021 00:50:22 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id BE44C143A5; Wed, 12 May 2021 17:08:46 +0000 (UTC) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by atuin.qyliss.net (Postfix) with ESMTPS id 1EA121435C for ; Wed, 12 May 2021 17:08:42 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 3D8AD134B for ; Wed, 12 May 2021 13:08:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 12 May 2021 13:08:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=wcvTM5yljjIR4F+YgyO3M1AzY5 VS4i82fS13m++RoCo=; b=nDfET/yufQZfdDsUn6sGAg2OEobkZmgdhYViCTnvKm +cVw9iXZj9r7GxLF0tDl+kS4Waf6jz3dqk0wXNPY31+0EjY50tSRiW4MgZ+P6IUA jhTSvJOnN1aPf8PYRGDlkLdwfKKQZVvzI5ARza1lF9BI7OPGFOt6yGuacpuaKUp1 sdTdPYU4TcQC9dB0w50fZClnrMAdUxUitqN+dQBhnZU0lCU3FURaQ6tE5mzNz87q qjvefOW//SqoBlFQBv43N7gMpI+bCUUQKhzqOuWWNqgK8y9IqmV1ErYL2a4AZ8uw 21h9sndznu309XpcE7GzQadVsmL8mtuSJiW+k61TAxiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=wcvTM5yljjIR4F+Yg yO3M1AzY5VS4i82fS13m++RoCo=; b=tHxO7e3uF2lUK0gK6LsFFIPNTtQdBFBr0 RWkYgDvMqsnpOnhv/Ke2eoboc4HiAXfuP6aqu1FHajcEpKV/TqCSuxs1yDGlVIqW iA5V9UfqA3ZvuC/Q31WRwa359WUy3qMBT5QsiOPpEA2SwLsyUbw1tmA+tlY/feZ8 6IFjLho+OayIBTHJ1T1PbS6lVK3cejU5guHOqC5rI/5EK3Gbsw1gOhywhF5jWyO/ cfnrOHTRiNszd2LeOy12/3ckiIP1vhavkGl4uzFHu0gDOfZqkTYRIuF4DpwvvFR/ Zxa3g1GydbbnA64XmlFk0jvOlR7AzpS9HqFY33PqOVHF+XrqZg9PA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehvddguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpeetlhihshhsrgcutfhoshhsuceohhhisegrlhihshhsrgdrihhs qeenucggtffrrghtthgvrhhnpeehvdffgffhteeijefgteeftdfghfdvheeuhedvjedugf eggfeljefgleefvefgfeenucfkphepkeegrddukeegrddvvdeirdekudenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehqhihlihhsshesvghvvg drqhihlhhishhsrdhnvght X-ME-Proxy: Received: from eve.qyliss.net (p54b8e251.dip0.t-ipconnect.de [84.184.226.81]) by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 12 May 2021 13:08:38 -0400 (EDT) Received: by eve.qyliss.net (Postfix, from userid 1000) id 2CBFD113F; Wed, 12 May 2021 17:08:36 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [RFC PATCH crosvm 0/4] Implement vhost-user-net Date: Wed, 12 May 2021 17:08:08 +0000 Message-Id: <20210512170812.192540-1-hi@alyssa.is> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 7ZEZPCCYLE2DPMK4Q2UOEB7ADJ2YIW6W X-Message-ID-Hash: 7ZEZPCCYLE2DPMK4Q2UOEB7ADJ2YIW6W X-MailFrom: qyliss@eve.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.4 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This is a proof of concept, so no need for code review on it. Here I have taken cloud-hypervisor's implementation of vhost-user-net, and ported it to crosvm. I based this on old versions of crosvm and cloud-hypervisor, with the idea being that it would be easier to get an initial working version from a time when the codebases had diverged less, which could then be gradually brought forward. A slight complication is that the cloud-hypervisor version I ported the implementation from didn't quite behave in the way the vhost-user specification[1] said it should, so patches 2 and 3 are backports of cloud-hypervisor fixes that happened later. Alyssa Ross (4): devices: port vhost-user-net from cloud-hypervisor vhost_rs: vhost_user: Add missing protocol features devices: vhost-user: Vring should be enabled after initialization crosvm: use vhost-user-net instead of virtio-net Cargo.lock | 731 ++++++++++------ Cargo.toml | 2 +- devices/Cargo.toml | 8 + devices/src/virtio/mod.rs | 2 + .../virtio/vhost_user/cloud_hypervisor/mod.rs | 1 + .../vhost_user/cloud_hypervisor/net_util.rs | 162 ++++ devices/src/virtio/vhost_user/handler.rs | 123 +++ devices/src/virtio/vhost_user/mod.rs | 82 ++ devices/src/virtio/vhost_user/net.rs | 230 +++++ .../src/virtio/vhost_user/vu_common_ctrl.rs | 110 +++ src/linux.rs | 32 +- src/main.rs | 2 +- vhost_rs/Cargo.toml | 26 + vhost_rs/LICENSE | 202 +++++ vhost_rs/LICENSE-BSD | 27 + vhost_rs/LICENSE-MIT | 24 + vhost_rs/README.md | 10 + vhost_rs/src/backend.rs | 130 +++ vhost_rs/src/lib.rs | 122 +++ vhost_rs/src/vhost_kern/mod.rs | 320 +++++++ vhost_rs/src/vhost_kern/vhost_binding.rs | 405 +++++++++ vhost_rs/src/vhost_kern/vsock.rs | 84 ++ vhost_rs/src/vhost_user/connection.rs | 737 ++++++++++++++++ vhost_rs/src/vhost_user/dummy_slave.rs | 250 ++++++ vhost_rs/src/vhost_user/master.rs | 757 ++++++++++++++++ vhost_rs/src/vhost_user/master_req_handler.rs | 258 ++++++ vhost_rs/src/vhost_user/message.rs | 823 ++++++++++++++++++ vhost_rs/src/vhost_user/mod.rs | 251 ++++++ vhost_rs/src/vhost_user/slave.rs | 48 + vhost_rs/src/vhost_user/slave_req_handler.rs | 582 +++++++++++++ vhost_rs/src/vhost_user/sock_ctrl_msg.rs | 464 ++++++++++ vhost_rs/src/vsock.rs | 30 + virtio-bindings/Cargo.toml | 6 + virtio-bindings/src/lib.rs | 15 + virtio-bindings/src/virtio_blk.rs | 486 +++++++++++ virtio-bindings/src/virtio_net.rs | 734 ++++++++++++++++ virtio-bindings/src/virtio_ring.rs | 453 ++++++++++ 37 files changed, 8461 insertions(+), 268 deletions(-) create mode 100644 devices/src/virtio/vhost_user/cloud_hypervisor/mod.rs create mode 100644 devices/src/virtio/vhost_user/cloud_hypervisor/net_util.rs create mode 100644 devices/src/virtio/vhost_user/handler.rs create mode 100644 devices/src/virtio/vhost_user/mod.rs create mode 100644 devices/src/virtio/vhost_user/net.rs create mode 100644 devices/src/virtio/vhost_user/vu_common_ctrl.rs create mode 100644 vhost_rs/Cargo.toml create mode 100644 vhost_rs/LICENSE create mode 100644 vhost_rs/LICENSE-BSD create mode 100644 vhost_rs/LICENSE-MIT create mode 100644 vhost_rs/README.md create mode 100644 vhost_rs/src/backend.rs create mode 100644 vhost_rs/src/lib.rs create mode 100644 vhost_rs/src/vhost_kern/mod.rs create mode 100644 vhost_rs/src/vhost_kern/vhost_binding.rs create mode 100644 vhost_rs/src/vhost_kern/vsock.rs create mode 100644 vhost_rs/src/vhost_user/connection.rs create mode 100644 vhost_rs/src/vhost_user/dummy_slave.rs create mode 100644 vhost_rs/src/vhost_user/master.rs create mode 100644 vhost_rs/src/vhost_user/master_req_handler.rs create mode 100644 vhost_rs/src/vhost_user/message.rs create mode 100644 vhost_rs/src/vhost_user/mod.rs create mode 100644 vhost_rs/src/vhost_user/slave.rs create mode 100644 vhost_rs/src/vhost_user/slave_req_handler.rs create mode 100644 vhost_rs/src/vhost_user/sock_ctrl_msg.rs create mode 100644 vhost_rs/src/vsock.rs create mode 100644 virtio-bindings/Cargo.toml create mode 100644 virtio-bindings/src/lib.rs create mode 100644 virtio-bindings/src/virtio_blk.rs create mode 100644 virtio-bindings/src/virtio_net.rs create mode 100644 virtio-bindings/src/virtio_ring.rs base-commit: 8a7e4e902a4950b060ea23b40c0dfce7bfa1b2cb -- 2.31.0