Skip to content

Commit 6449e41

Browse files
committed
feat(vmm): run virtio-net on vhost-net with configurable queue pairs
1 parent 027c62b commit 6449e41

18 files changed

Lines changed: 3841 additions & 380 deletions

File tree

dstack/vmm/rpc/proto/vmm_rpc.proto

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,30 @@ message VmInfo {
3939
repeated GuestEvent events = 14;
4040
// Effective network interfaces resolved against node config.
4141
repeated NetworkInterfaceStatus interfaces = 15;
42+
// Whether a QEMU process exists for this VM right now. The interfaces above
43+
// are what it built only while this is true; otherwise they are what the next
44+
// launch would build.
45+
bool running = 16;
4246
}
4347

4448
// Runtime status of a resolved VM network interface.
4549
message NetworkInterfaceStatus {
46-
// Product-facing mode: "user", "bridge", or "custom".
50+
// Product-facing mode: "user", "bridge", "macvtap", or "custom".
4751
string mode = 1;
48-
// QEMU/network backend shape: "slirp", "tap_bridge", or "custom".
52+
// QEMU/network backend shape: "slirp", "tap_bridge", "macvtap", or "custom".
4953
string backend = 2;
5054
string mac = 3;
5155
// Linux bridge name for tap_bridge backend.
5256
optional string bridge_name = 4;
5357
// QEMU netdev id, e.g. "net0".
5458
optional string netdev_id = 5;
59+
// Effective vhost-net data plane state for this interface. Absent for custom
60+
// mode, where the operator supplies the whole netdev string and the VMM does
61+
// not parse it, so it knows of no data-plane state to report.
62+
optional bool vhost = 6;
63+
// Effective virtio-net queue pairs. Absent for custom mode, for the same
64+
// reason as vhost.
65+
optional uint32 queues = 7;
5566
}
5667

5768
// Structured log or lifecycle event emitted by the guest or runtime.
@@ -135,6 +146,12 @@ message NetworkingConfig {
135146
// Effective macvtap forwarding mode in responses. Deployment requests must
136147
// leave this empty because the mode is controlled by node configuration.
137148
string macvtap_mode = 4;
149+
// Move packet processing into the host kernel vhost-net data plane. Unset
150+
// inherits the node default. User mode has no vhost backend and ignores it.
151+
optional bool vhost = 5;
152+
// virtio-net queue pairs. Unset inherits the node default. Bounded by the
153+
// node's cvm.max_net_queues.
154+
optional uint32 queues = 6;
138155
}
139156

140157
// Requested GPU layout for a CVM.
@@ -301,6 +318,8 @@ message NetworkingCapabilities {
301318
reserved "forward_service_enabled";
302319
// Default bridge configured in vmm.toml [cvm.networking].bridge.
303320
string default_bridge = 4;
321+
// Largest virtio-net queue pair count a deployment request may ask for.
322+
uint32 max_queues = 5;
304323
}
305324

306325
// Aggregated metadata exposed through GetMeta.

dstack/vmm/src/app.rs

Lines changed: 256 additions & 79 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)