mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Enforce a minimum number of queues
Even though the driver can provide fewer queues than those advertised for some device types their is a minimum number that is required for operation. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
a105089702
commit
c90f77e399
@@ -224,6 +224,7 @@ pub struct VirtioCommon {
|
||||
pub epoll_threads: Option<Vec<thread::JoinHandle<()>>>,
|
||||
pub queue_sizes: Vec<u16>,
|
||||
pub device_type: u32,
|
||||
pub min_queues: u16,
|
||||
}
|
||||
|
||||
impl VirtioCommon {
|
||||
@@ -259,6 +260,15 @@ impl VirtioCommon {
|
||||
return Err(ActivateError::BadActivate);
|
||||
}
|
||||
|
||||
if queues.len() < self.min_queues.into() {
|
||||
error!(
|
||||
"Number of enabled queues lower tham min: {} vs {}",
|
||||
queues.len(),
|
||||
self.min_queues
|
||||
);
|
||||
return Err(ActivateError::BadActivate);
|
||||
}
|
||||
|
||||
let kill_evt = EventFd::new(EFD_NONBLOCK).map_err(|e| {
|
||||
error!("failed creating kill EventFd: {}", e);
|
||||
ActivateError::BadActivate
|
||||
|
||||
Reference in New Issue
Block a user