net_consomme: decouple control requests from packet processing path - #4378
Open
Daman Mulye (damanm24) wants to merge 1 commit into
Open
net_consomme: decouple control requests from packet processing path#4378Daman Mulye (damanm24) wants to merge 1 commit into
Daman Mulye (damanm24) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces cross-cutting networking/control-path and concurrency changes (new endpoint action flow + shared listener registries) that warrant final human validation beyond automated review.
Pull request overview
This PR changes net_consomme so control requests (e.g., port bind/unbind, state updates) make progress independently of the packet processing path, avoiding stalls when the guest is idle. It introduces a listener-only control capability backed by shared listener tables, while deferring stateful requests until a queue restart can safely apply them.
Changes:
- Move control-request draining to the endpoint control path (
wait_for_endpoint_action) and buffer restart-requiring requests until the next queue start. - Add a queue-independent
ListenerControlbacked by locked TCP/UDP listener registries so frequent bind/unbind operations don’t require restarting queues. - Add an end-to-end ttrpc test that validates Consommé host port forwarding bind/unbind behavior.
File summaries
| File | Description |
|---|---|
| vmm_tests/vmm_tests/tests/tests/ttrpc.rs | Adds an end-to-end ttrpc-driven port-forwarding test (bind, connect/verify banner, unbind/verify refusal). |
| vm/devices/net/net_consomme/src/resolver.rs | Wires the endpoint to accept a generalized request receiver (renamed from port-only channel). |
| vm/devices/net/net_consomme/src/lib.rs | Implements endpoint-side request draining + buffering, introduces listener-control handling, and adds endpoint actions for restart triggering. |
| vm/devices/net/net_consomme/consomme/src/udp.rs | Makes UDP listeners a shared, lock-protected registry and adds a bind/unbind control surface usable outside the packet loop. |
| vm/devices/net/net_consomme/consomme/src/tcp/tests.rs | Updates TCP tests for the new lock-wrapped listener table. |
| vm/devices/net/net_consomme/consomme/src/tcp.rs | Makes TCP listeners a shared, lock-protected registry and adds a bind/unbind control surface usable outside the packet loop. |
| vm/devices/net/net_consomme/consomme/src/lib.rs | Introduces a public ListenerControl abstraction to manage TCP/UDP listeners without queue-owned state. |
| vm/devices/net/net_backend_resources/src/lib.rs | Expands ConsommeRequest to include DNS-record and virtual-address operations and adds a serializable DNS record config. |
Review details
Suppressed comments (1)
vm/devices/net/net_consomme/src/lib.rs:276
ConsommeMessageErrorstill definesBindandDnsRecordvariants, but the updatedConsommeControlmethods now surface bind/unbind/DNS failures viaRemote(mesh::error::RemoteError)instead (no in-file construction of those variants, and no uses across the repo). Keeping unused public variants here is misleading for callers and makes it harder to reason about which errors can actually be returned.
/// Error type returned from some dynamic update functions like bind_port.
#[derive(Debug, Error)]
pub enum ConsommeMessageError {
/// Communication error with running instance.
#[error("communication error")]
- Files reviewed: 8/8 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, consommé control messages are only dequeued/handled when the backend is being polled for network packets. If a guest stops driving the NIC for packets, control requests are never dequeued/handled by consommé.
This PR moves control requests polling to the endpoint control path, so requests continue to make progress independent of packet flows.
Control requests fall into two categories based on whether they require access to queue-owned consommé state.
Requests such as adding static DNS records, creating virtual addresses, and updating network parameters modify broader protocol state. These requests are buffered by the endpoint and applied when it regains ownership of the consommé state, which requires restarting the network queues.
Port bind and unbind requests only modify the TCP or UDP listener tables. They also occur much more frequently than the other control operations. Restarting the queues for every bind or unbind would repeatedly interrupt packet processing and impose a significant throughput penalty, particularly for workloads that frequently create and remove port forwards.
To avoid that cost, the listener tables use a locking mechanism and expose a separate listener-control capability. Bind and unbind requests can therefore be applied directly while the queues continue running. Requests that require broader mutable state still use the deferred queue-restart path.