mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
net_util, virtio-devices, vmm: Accept multiple TAP fds
This patch enables multi-queue support for creating virtio-net devices by accepting multiple TAP fds, e.g. '--net fds=3:7'. Fixes: #2164 Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
@@ -297,21 +297,28 @@ impl Net {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn from_tap_fd(
|
||||
pub fn from_tap_fds(
|
||||
id: String,
|
||||
fd: RawFd,
|
||||
fds: &[RawFd],
|
||||
guest_mac: Option<MacAddr>,
|
||||
iommu: bool,
|
||||
queue_size: u16,
|
||||
seccomp_action: SeccompAction,
|
||||
) -> Result<Self> {
|
||||
let tap = Tap::from_tap_fd(fd).map_err(Error::TapError)?;
|
||||
let mut taps: Vec<Tap> = Vec::new();
|
||||
let num_queue_pairs = fds.len();
|
||||
|
||||
for fd in fds.iter() {
|
||||
let tap = Tap::from_tap_fd(*fd, num_queue_pairs).map_err(Error::TapError)?;
|
||||
taps.push(tap);
|
||||
}
|
||||
|
||||
Self::new_with_tap(
|
||||
id,
|
||||
vec![tap],
|
||||
taps,
|
||||
guest_mac,
|
||||
iommu,
|
||||
2,
|
||||
num_queue_pairs * 2,
|
||||
queue_size,
|
||||
seccomp_action,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user