Skip to content

Commit

Permalink
stratovirt: enable net mq
Browse files Browse the repository at this point in the history
  • Loading branch information
astro committed Jan 9, 2024
1 parent f1d7053 commit d3d617b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/runners/stratovirt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ let
kernel initrdPath
storeOnDisk storeDisk;

tapMultiQueue = vcpu > 1;

inherit (import ../. { nixpkgs-lib = pkgs.lib; }) withDriveLetters;
volumes = withDriveLetters microvmConfig;

Expand Down Expand Up @@ -63,6 +65,8 @@ let
echo '${builtins.toJSON data}' | nc -U "${socket}"
'';
in {
inherit tapMultiQueue;

command = lib.escapeShellArgs (
[
"${pkgs.stratovirt}/bin/stratovirt"
Expand Down Expand Up @@ -112,6 +116,7 @@ in {
[
(if type == "macvtap" then "tap" else "${type}")
"id=${id}"
"queues=${toString (lib.min 16 vcpu)}"
]
++ lib.optionals (type == "user" && forwardPortsOptions != []) forwardPortsOptions
++ lib.optionals (type == "bridge") [
Expand All @@ -126,7 +131,15 @@ in {
)
)
# TODO: devType (0x10 + i)
"-device" "virtio-net-${devType 30},id=net_${id},netdev=${id},mac=${mac}"
"-device" (
lib.concatStringsSep "," [
"virtio-net-${devType 30}"
"id=net_${id}"
"netdev=${id}"
"mac=${mac}"
"mq=${if tapMultiQueue then "on" else "off"}"
]
)
]) interfaces
)
++
Expand Down

0 comments on commit d3d617b

Please sign in to comment.