runtime-rs: Introduce a field for mapping configuration network_queues

Number of virtio queue pairs (each pair = 1 RX + 1 TX).
Derived from `network_queues` in the hypervisor TOML config.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
Alex Lyn
2026-06-29 20:18:08 +08:00
parent 181c47a28c
commit 1ddeb3bd85

View File

@@ -36,6 +36,9 @@ pub struct NetworkPair {
pub virt_iface: NetworkInterface,
pub model: Arc<dyn network_model::NetworkModel>,
pub network_qos: bool,
/// Number of virtio queue pairs (each pair = 1 RX + 1 TX).
/// Derived from `network_queues` in the hypervisor TOML config.
pub network_queues: usize,
}
impl NetworkPair {
@@ -46,6 +49,8 @@ impl NetworkPair {
model: &str,
queues: usize,
) -> Result<Self> {
// Ensure that the queues >= 1
let queues = queues.max(1);
let unique_id = kata_sys_util::rand::UUID::new();
let model = network_model::new(model).context("new network model")?;
let tap_iface_name = format!("tap{idx}{TAP_SUFFIX}");
@@ -127,6 +132,7 @@ impl NetworkPair {
},
model,
network_qos: false,
network_queues: queues,
};
Ok(net_pair)