mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: Implement multiple queue support for net devices
Update the common part in net_util.rs under vm-virtio to add mq support, meanwhile enable mq for virtio-net device, vhost-user-net device and vhost-user-net backend. Multiple threads will be created, one thread will be responsible to handle one queue pair separately. To gain the better performance, it requires to have the same amount of vcpus as queue pair numbers defined for the net device, due to the cpu affinity. Multiple thread support is not added for vhost-user-net backend currently, it will be added in future. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
404316eea1
commit
652e7b9b8a
@@ -24,7 +24,6 @@ use kvm_bindings::kvm_irq_routing_entry;
|
||||
use kvm_ioctls::*;
|
||||
use libc::O_TMPFILE;
|
||||
use libc::TIOCGWINSZ;
|
||||
use net_util::Tap;
|
||||
#[cfg(feature = "pci_support")]
|
||||
use pci::{
|
||||
DeviceRelocation, InterruptDelivery, InterruptParameters, PciBarRegionType, PciBus,
|
||||
@@ -991,18 +990,28 @@ impl DeviceManager {
|
||||
if let Some(net_list_cfg) = &vm_info.vm_cfg.lock().unwrap().net {
|
||||
for net_cfg in net_list_cfg.iter() {
|
||||
let virtio_net_device = if let Some(ref tap_if_name) = net_cfg.tap {
|
||||
let tap = Tap::open_named(tap_if_name, 1).map_err(DeviceManagerError::OpenTap)?;
|
||||
Arc::new(Mutex::new(
|
||||
vm_virtio::Net::new_with_tap(tap, Some(net_cfg.mac), net_cfg.iommu)
|
||||
.map_err(DeviceManagerError::CreateVirtioNet)?,
|
||||
vm_virtio::Net::new(
|
||||
Some(tap_if_name),
|
||||
None,
|
||||
None,
|
||||
Some(net_cfg.mac),
|
||||
net_cfg.iommu,
|
||||
net_cfg.num_queues,
|
||||
net_cfg.queue_size,
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVirtioNet)?,
|
||||
))
|
||||
} else {
|
||||
Arc::new(Mutex::new(
|
||||
vm_virtio::Net::new(
|
||||
net_cfg.ip,
|
||||
net_cfg.mask,
|
||||
None,
|
||||
Some(net_cfg.ip),
|
||||
Some(net_cfg.mask),
|
||||
Some(net_cfg.mac),
|
||||
net_cfg.iommu,
|
||||
net_cfg.num_queues,
|
||||
net_cfg.queue_size,
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVirtioNet)?,
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user