mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: Implement refactor for net devices and backend
Since the common parts are put into net_util.rs under vm-virtio, refactoring code for virtio-net device, vhost-user-net device and backend to shrink the code size and improve readability meanwhile. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
6ae2597d19
commit
1ae7deb393
@@ -993,7 +993,7 @@ impl DeviceManager {
|
||||
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)?;
|
||||
Arc::new(Mutex::new(
|
||||
vm_virtio::Net::new_with_tap(tap, Some(&net_cfg.mac), net_cfg.iommu)
|
||||
vm_virtio::Net::new_with_tap(tap, Some(net_cfg.mac), net_cfg.iommu)
|
||||
.map_err(DeviceManagerError::CreateVirtioNet)?,
|
||||
))
|
||||
} else {
|
||||
@@ -1001,7 +1001,7 @@ impl DeviceManager {
|
||||
vm_virtio::Net::new(
|
||||
net_cfg.ip,
|
||||
net_cfg.mask,
|
||||
Some(&net_cfg.mac),
|
||||
Some(net_cfg.mac),
|
||||
net_cfg.iommu,
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVirtioNet)?,
|
||||
|
||||
Reference in New Issue
Block a user