src: Add multiple queue checking in vhost-user-net integration test
Update queue number with 4 to verify if vhost-user-net device
and backend could work well with multiple queue.
@@ -2519,16 +2519,17 @@ mod tests {
.args(&[
"--backend",
format!(
- "ip={},mask=255.255.255.0,sock=/tmp/vunet.sock",
+ "ip={},mask=255.255.255.0,sock=/tmp/vunet.sock,num_queues=4,queue_size=1024",
guest.network.host_ip
)
.as_str(),
])
.spawn()
.unwrap();
+ thread::sleep(std::time::Duration::new(10, 0));
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
- .args(&["--cpus", "boot=1"])
+ .args(&["--cpus", "boot=4"])
.args(&["--memory", "size=512M,file=/dev/shm"])
.args(&["--kernel", guest.fw_path.as_str()])
.args(&[
@@ -2546,11 +2547,16 @@ mod tests {
])
.args(&[
"--vhost-user-net",
- format!("mac={},sock=/tmp/vunet.sock", guest.network.guest_mac).as_str(),
+ format!(
+ "mac={},sock=/tmp/vunet.sock,num_queues=4,queue_size=1024",
+ guest.network.guest_mac
+ )
+ .as_str(),
])
.spawn()
.unwrap();
+ thread::sleep(std::time::Duration::new(10, 0));
// 1 network interface + default localhost ==> 2 interfaces
// It's important to note that this test is fully exercising the
// vhost-user-net implementation and the associated backend since
@@ -2568,6 +2574,29 @@ mod tests {
2
);
+ thread::sleep(std::time::Duration::new(10, 0));
+
+ // The following pci devices will appear on guest with PCI-MSI
+ // interrupt vectors assigned.
+ // 1 virtio-console with 3 vectors: config, Rx, Tx
+ // 1 virtio-blk with 2 vectors: config, Request
+ // 1 virtio-blk with 2 vectors: config, Request
+ // 1 virtio-rng with 2 vectors: config, Request
+ // Since virtio-net has 2 queue pairs, its vectors is as follows:
+ // 1 virtio-net with 5 vectors: config, Rx (2), Tx (2)
+ // Based on the above, the total vectors should 14.
+ aver_eq!(
+ tb,
+ guest
+ .ssh_command("grep -c PCI-MSI /proc/interrupts")
+ .unwrap_or_default()
+ .trim()
+ .parse::<u32>()
+ .unwrap_or_default(),
+ 14
+ );
+
+ thread::sleep(std::time::Duration::new(10, 0));
guest.ssh_command("sudo shutdown -h now")?;
thread::sleep(std::time::Duration::new(5, 0));
let _ = cloud_child.kill();
