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