Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng committed Feb 13, 2025
1 parent aa02b08 commit b07939c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lisa/tools/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ def create_vm(
f"-device {nic_model},netdev=nettap{self.interface_count},"
f"mac={random_mac_address} "
)

base_cmd = f"-netdev tap,id=nettap{self.interface_count},script=no"

# vhost-net is a kernel module that accelerates virtio-net performance
# by offloading packet processing from QEMU's user space to the host
# kernel reducing latency and CPU overhead
if self.node.tools[KernelConfig].is_enabled("CONFIG_VHOST_NET"):
# vhose-net depends on CONFIG_VHOST_NET kernel config
cmd += f"-netdev tap,id=nettap{self.interface_count},vhost=on,script=no "
else:
cmd += f"-netdev tap,id=nettap{self.interface_count},script=no "
base_cmd += ",vhost=on"

cmd += base_cmd + " "
added_taps.append(f"tap{self.interface_count}")
self.interface_count += 1

Expand Down

0 comments on commit b07939c

Please sign in to comment.