net_util: Add multiple queue support for tap

Add support to allow VMMs to open the same tap device many times, it will
create multiple file descriptors meanwhile.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
Cathy Zhang
2020-01-10 00:03:24 +08:00
committed by Sebastien Boeuf
parent cf7e0cdf95
commit 4ab88a8173
3 changed files with 28 additions and 17 deletions
+1 -1
View File
@@ -991,7 +991,7 @@ 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).map_err(DeviceManagerError::OpenTap)?;
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)?,