Skip to content

Commit baa8764

Browse files
committed
stratovirt: enable net mq
1 parent a4559b1 commit baa8764

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/runners/stratovirt.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ let
1212
kernel initrdPath
1313
storeOnDisk storeDisk;
1414

15+
tapMultiQueue = vcpu > 1;
16+
1517
inherit (import ../. { nixpkgs-lib = pkgs.lib; }) withDriveLetters;
1618
volumes = withDriveLetters microvmConfig;
1719

@@ -63,6 +65,8 @@ let
6365
echo '${builtins.toJSON data}' | nc -U "${socket}"
6466
'';
6567
in {
68+
inherit tapMultiQueue;
69+
6670
command = lib.escapeShellArgs (
6771
[
6872
"${pkgs.stratovirt}/bin/stratovirt"
@@ -112,6 +116,7 @@ in {
112116
[
113117
(if type == "macvtap" then "tap" else "${type}")
114118
"id=${id}"
119+
"queues=${toString (lib.min 16 vcpu)}"
115120
]
116121
++ lib.optionals (type == "user" && forwardPortsOptions != []) forwardPortsOptions
117122
++ lib.optionals (type == "bridge") [
@@ -126,7 +131,15 @@ in {
126131
)
127132
)
128133
# TODO: devType (0x10 + i)
129-
"-device" "virtio-net-${devType 30},id=net_${id},netdev=${id},mac=${mac}"
134+
"-device" (
135+
lib.concatStringsSep "," [
136+
"virtio-net-${devType 30}"
137+
"id=net_${id}"
138+
"netdev=${id}"
139+
"mac=${mac}"
140+
"mq=${if tapMultiQueue then "on" else "off"}"
141+
]
142+
)
130143
]) interfaces
131144
)
132145
++

0 commit comments

Comments
 (0)